访问Google Drive API返回空文件列表 [英] Access Google Drive API Returns Empty File List

查看:127
本文介绍了访问Google Drive API返回空文件列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在测试Google Drive API。测试脚本通过HTTP GET来访问文件 - >列表API,但不知何故,我总是在项目中获得一个空列表。我的谷歌驱动器中有数百个文件,所以结果是意外的。 HTTP响应如下所示。

  {
kind:drive#fileList,
etag:\ VEU5fga3uYlZRf0pG-N1kS4iWP4 / Kxo5eGvPKynWfroe9v5L5T43-n0\,
selfLink:https://www.googleapis.com/drive/v2/files?maxResults=5,
items :[]
}


解决方案

帐户以访问我自己的Google云端硬盘中的文件,我必须为服务帐户的电子邮件地址授予权限。一旦权限设置正确,该列表就会填充允许服务帐户访问的文件。

I'm testing out the Google Drive API. The test script does the HTTP GET to access the Files->List API but somehow I always get an empty list in items. I have hundreds of files in my google drive so the result is unexpected. The HTTP response is shown below.

    {
     "kind": "drive#fileList",
     "etag": "\"VEU5fga3uYlZRf0pG-N1kS4iWP4/Kxo5eGvPKynWfroe9v5L5T43-n0\"",
     "selfLink": "https://www.googleapis.com/drive/v2/files?maxResults=5",
     "items": []
    }

解决方案

To allow service account to access the files in my own Google Drive, I have to give permission to the email address of the service account. Once the permissions are setup correctly, the list gets populated with the files that the service account is allowed to access.

这篇关于访问Google Drive API返回空文件列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆