google-api-nodejs-client

Google datastore.lookup in Node.js returns no results

*爱你&永不变心* 提交于 2019-12-25 02:51:10
问题 I'm trying to run a simple lookup against my Google datastore data via the google-api-nodejs-client JS plugin. When I run this lookup using Google's "try it now" tool, it works fine: Request POST https://www.googleapis.com/datastore/v1beta2/datasets/healthier-staging/lookup?key={YOUR_API_KEY} { "keys": [ { "path": [ { "kind": "Subscriber", "name": "+1215XXXXXXX" } ] } ] } Response 200 OK { "found": [ { "entity": { "key": { "partitionId": { "datasetId": "s~healthier-staging" }, "path": [ {

Google datastore.lookup in Node.js returns no results

旧巷老猫 提交于 2019-12-25 02:51:00
问题 I'm trying to run a simple lookup against my Google datastore data via the google-api-nodejs-client JS plugin. When I run this lookup using Google's "try it now" tool, it works fine: Request POST https://www.googleapis.com/datastore/v1beta2/datasets/healthier-staging/lookup?key={YOUR_API_KEY} { "keys": [ { "path": [ { "kind": "Subscriber", "name": "+1215XXXXXXX" } ] } ] } Response 200 OK { "found": [ { "entity": { "key": { "partitionId": { "datasetId": "s~healthier-staging" }, "path": [ {

How to upload a partial stream to Google Drive using Node.JS

泪湿孤枕 提交于 2019-12-25 01:02:45
问题 I want to achieve the functionality where I can upload a certain part of a file to Google Drive. I am able to do this by splitting the original read stream into multiple write steams and then uploading them, but this technique isn't acceptable since the write streams will live on the server (which I don't want). I've tried to overcome this by sending the original read stream in the body of the upload request but I can't find a way to stop the upload when a certain condition is met. My upload

How to get progress status while uploading files to Google Drive using NodeJs?

血红的双手。 提交于 2019-12-24 18:50:25
问题 Im trying to get progress status values while uploading files to google Drive using nodeJs. controller.js exports.post = (req, res) => { //file content is stored in req as a stream // 1qP5tGUFibPNaOxPpMbCQNbVzrDdAgBD is the folder ID (in google drive) googleDrive.makeFile("file.txt","1qP5tGUFibPNaOxPpMbCQNbVzrDdAgBD",req); }; googleDrive.js ... makeFile: function (fileName, root,req) { var fileMetadata = { 'name': fileName, 'mimeType': 'text/plain', 'parents': [root] }; var media = { mimeType

NodeJS - Google API Module - [TypeError: Cannot read property 'prototype' of undefined]

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-24 12:52:01
问题 I installed the nodejs module "googleapis" ( npm install googleapis ) to an Azure Mobile Services instance and I wanted to do a quick test with some sample code I found here https://www.npmjs.org/package/googleapis. After trying the code sample which creates a text file in google drive I get the following error message in the console: [TypeError: Cannot read property 'prototype' of undefined] The error is occurring at line 40 of the current version of google-api-nodejs-client / apis / index

How can I make 3 thousand requests to Google Drive API using node.js without exceeding User Rate Limit?

纵然是瞬间 提交于 2019-12-24 11:18:54
问题 I am helping a friend which has the following problem. He wants to have 3000 folders in google drive. For each one of them he will generate a QR code pointing to their URL. He will fill each folder with a photo people will take themselves on an event and people will then take home a small card with the QR code of their folder printed on it so they can see the photo home. I made a small nodejs program using google's official nodejs client, and it works perfectly for one folder. Here's the code

Email with attachment is not going properly with gmail api

*爱你&永不变心* 提交于 2019-12-24 06:04:34
问题 This is the following piece of code I have written in node.js for sending email with attachment using gmail api: And I am using request-promise module of node js to send request to that api. let user = await db.model('User').findOne({ _id: userId }); let filepath = fs.readFileSync(req.file.path).toString('base64'); // let filepath = fs.readFileSync(req.file.path); let from = user.crmOptions.email; let raw = [ 'Content-Type: multipart/mixed; boundary="boundary_mail"\r\n', 'MIME-Version: 1.0\r

Whether to use googleapis or google-cloud library for node js

风格不统一 提交于 2019-12-23 12:33:54
问题 I see there are two available libraries. I am wondering what are the differences? Are they both officially maintained by Google? https://www.npmjs.com/package/googleapis https://www.npmjs.com/package/google-cloud 回答1: Yes both are maintained by Google. googleapis covers all these APIs (drive, calendar, admin sdk, maps, etc) whereas google-cloud covers the cloud platform stuff like bigquery, datastore, cloud storage, bigtable, pub/sub, etc. There appears to be overlap and I don't know which

Google API Batch Request with Node

拟墨画扇 提交于 2019-12-23 06:48:33
问题 I noticed Google removed batch requests from their Node client recently: https://github.com/google/google-api-nodejs-client/blob/0db674b7d3a04cf65e223f876cf7b3f427025cd4/MIGRATING.md How might I write a batch request with Node? I'm trying to get the content of emails in Gmail given a set of message IDs. Here's how Google says I should do it, but I've never made this type of request before: https://developers.google.com/gmail/api/guides/batch 回答1: I've created a module as a stop gap! https:/

Google Authentication Token return doesn't contain refresh_token

五迷三道 提交于 2019-12-22 09:49:51
问题 I write an example about google api using. Google NodeJS Client library. I have followed the instruction set access_type : 'offline' , however the object return doesn't contains refresh_token . My Code: var http = require('http'); var express = require('express'); var Session = require('express-session'); var google = require('googleapis'); var plus = google.plus('v1'); var OAuth2 = google.auth.OAuth2; const ClientId = "251872680446-rvkcvm5mjn1ps32iabf4i2611hcg086e.apps.googleusercontent.com"