访问Google Drive API返回空文件列表 [英] Access Google Drive API Returns Empty File List
问题描述
我正在测试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屋!