Tag: sdk

如何仅使用Google云端硬盘的REST API检查访问令牌是否有效?

我在PHP中实现了这个问题的答案,在这个问题上已经转换了代码。 $ch = curl_init(); curl_setopt( $ch, CURLOPT_URL, "https://www.googleapis.com/oauth2/v3/tokeninfo?access_token=$access_token" ) ; curl_setopt( $ch, CURLOPT_PORT , 443 ) ; curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ) ; curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ) ; curl_setopt( $ch, CURLOPT_HEADER, false ) ; curl_setopt( $ch, CURLOPT_HTTPHEADER, array("Content-Type: application/x-www-form-urlencoded") ) ; $response = curl_exec( $ch ) ; error_log($response); 当我运行代码时,我收到: HTTP/1.1 400 Bad Request Vary: […]

如何批量谷歌驱动器调用Nodejs

我正在考虑批量处理Google Drive的要求。 Google Drive API提供了一个如何在Nodejs中批量请求的例子。 然而,它使用asynchronous和查找方法告诉我,它一次执行一个,我不清楚它是如何批量我的请求。 可以批量处理Google API调用 。 代码示例如下。 var fileId = '1sTWaJ_j7PkjzaBWtNc3IzovK5hQf21FbOw9yLeeLPNQ'; var permissions = [ { 'type': 'user', 'role': 'writer', 'emailAddress': 'user@example.com' }, { 'type': 'domain', 'role': 'writer', 'domain': 'example.com' } ]; // Using the NPM module 'async' async.eachSeries(permissions, function (permission, permissionCallback) { drive.permissions.create({ resource: permission, fileId: fileId, fields: 'id', }, function […]

节点:使用查询列出所有文件的Google Drive API

我是否可以知道如何使用GoogleAPIS库在Google云端硬盘中查询使用查询的所有文件? https://github.com/google/google-api-nodejs-client/ 我不知道,如何使用这个库! 我不知道我应该把我的查询,我已经尝试了下面的代码,但我没有得到任何回应.. testing1: drive.files.list("mimeType='image/jpg'", function(data){ //I am getting all the data, the query is not working.. )); testing2: drive.files.list({ media: { mimeType: 'application/vnd.google-apps.folder' } }, function(err, data){ //I am getting all the data, the query is not working.. }); testing3: drive.files.list({ resource: { mimeType: 'application/vnd.google-apps.folder' } }, function(err, data){ //This returns error not […]

如何上传xlsx文件到我自己的谷歌驱动器,然后将其转换为谷歌电子表格,并获得可编程共享链接?

我正在做一个node.js服务器。 我想要上传并将.xlsx文件转换为Google电子表格,然后以编程方式获取可分享的链接。 但是,我发现谷歌驱动API是专门为build设应用程序的其他用户访问他们的驱动器做你的应用程序的东西,但不是以编程方式访问自己的驱动器。 我理解正确吗? 我已经阅读了很多关于谷歌开发人员的文档和一些关于这个教程,但我找不到我想要的方式。 有什么办法可以做我想要的吗? 你能给我一些指导吗?

Box或Google Drive作为nodejs webapp的存储

我正在开发一个需要上传一些媒体的nodejs中的webapp,并决定是否将Google Drive或Box用作存储我的应用程序的静态媒体。 两种解决scheme都使用oauth2进行身份validation,但是我无法理解如何将节点应用程序连接到单个帐户(存储位置必须是)。 问题是我找不到符合我的问题的例子。 我需要做什么来实现这个? 如果不可能,有什么好的云存储替代品可以提供免费空间? 我不想在生产环境之前支付服务费用

无法挑选区域和/或区域。 当部署一个NodeJS托pipe虚拟机应用程序

在遵循App Engine Managed VM NodeJS教程的同时 ,我现在遇到了一个部署问题(见下文)。 昨天,我可以成功部署。 但今天,使用相同的代码和命令,它失败了。 有人遇到同样的情况? bash-3.2$ gcloud preview app deploy app.yaml –set-default You are about to deploy the following modules: – test-node-mvm/default/20150603t163041 From: [/Users/steren/work/1-hello-world/app.yaml] Do you want to continue (Y/n)? y Updating module [default]…Pushing image to Google Container Registry… The push refers to a repository [gcr.io/_m_sdk/test-node-mvm.default.20150603t163041] (len: 1) Sending image list […]

如何查看谷歌驱动器API的文件和文件夹?

我创build了一个谷歌项目,并设置所有我需要使用谷歌驱动器API与JWT crementials。 它不需要任何auth2authentication,因为它是服务器 – 服务器通信,用户不参与进程。 这工作正常,但为什么它不使用我的帐户驱动器? 如果我创build一个文件夹或文件,我不能在谷歌驱动器中看到它,所以这是使用不同的存储,如果是这样,我有办法看到我的所有文件和文件夹像一个正常的谷歌驱动器帐户? 我正在使用nodeJs,到目前为止这工作: var google = require('googleapis'); var drive = google.drive('v3'); var config = require('../config/config'); var jwtClient = new google.auth.JWT(config.google.drive.client_email, null, config.google.drive.private_key, ['https://www.googleapis.com/auth/drive'], null); jwtClient.authorize(function(err, tokens) { if (err) { console.log(err); return; } // Make an authorized request to list Drive files. //drive.files.create({ // auth: jwtClient, // resource: { // […]

cordova没有findAVD

在Cordova文档中按照设置Cordova for Android开发的说明之后 ,我遇到了这个错误: Error: No emulator images (avds) found. 1. Download desired System Image by running: /Users/Jacob/Library/Android/sdk/tools/android sdk 2. Create an AVD by running: /Users/Jacob/Library/Android/sdk/tools/android avd HINT: For a faster emulator, use an Intel System Image and install the HAXM device driver 我发现每一个其他的职位只是说要添加一个模拟器,但我已经做到了。 在Android Studio中,我其实已经做了三个! 还值得一提的是cordova曾经能够运行模拟器,但是为了解决另一个问题,我碰到了这个问题。 我遇到了权限问题,现在每次运行Cordova命令时都必须使用sudo 。 这可能与此有关吗? 这是我的.bash_profile: ANDROID_HOME=/Users/Jacob/Library/Android/sdk PATH=${PATH}:/Users/Jacob/Library/Android/sdk/platform-tools:/Users/Jacob/Library/Android/sdk/tools JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home 我一直试图在cordova使用Android […]

Webshot到谷歌驱动器,而不使用缓冲区或stream存储中间文件?

TL;博士 我目前正尝试使用网页截图获取屏幕截图,并将其上传到Google云端硬盘, 而不 会将 文件保存到文件系统作为此过程中的中间步骤。 任何代码 – 无论采用哪种方式 – 都可以让我做到这一点,是最受欢迎的! 我试过了 我能够通过从webshot保存文件然后将该file upload到Google Drive来本地运行系统,但是在我使用的服务器环境(Elastic Beanstalk)上这是不可能的,我想避免这种混乱。 Webshot允许stream式传输屏幕截图。 这里是他们的示例代码: var webshot = require('webshot'); var fs = require('fs'); var renderStream = webshot('google.com'); var file = fs.createWriteStream('google.png', {encoding: 'binary'}); renderStream.on('data', function(data) { file.write(data.toString('binary'), 'binary'); }); 但是,这似乎达到了只是写入文件相同的目的。 Google Drive,在他们的google-api-nodejs-client (我使用)允许将主体设置为可读stream。 这里是他们的示例代码: var fs = require('fs'); var drive = google.drive({ version: […]

我如何使用googleapis进行反应?

目前,我正在尝试使用谷歌驱动器API V3作出反应的本地。 我正在从谷歌驱动器API v3 Node.js作为一个例子。 但问题是,当我试图将googleapis导入到我的项目中显示下面的错误。 我GOOGLE了很多次,但无法find解决scheme。 有人能帮我解决吗?