繁体   English   中英

为什么用Google Cloud Drive Rest API file.list 获取不到所有文件?

[英]Why using Google Cloud Drive Rest API file.list can not get all the files?

我正在使用以下 CURL 命令来检索我所有的谷歌驱动器文件,但是,它只列出了所有文件中非常有限的一部分。 为什么?

curl -H "Authorization: Bearer ya29.hereshouldbethemaskedaccesstokenvalue" https://www.googleapis.com/drive/v3/files

结果

{
"kind": "drive#fileList",
"incompleteSearch": false,
"files": [
{
"kind": "drive#file",
id": "2fileidxxxxxxxx",
"name": "testnum",
"mimeType": "application/vnd.google-apps.folder"
},
{
"kind": "drive#file",
"id": "1fileidxxxxxxx",
"name": "test2.txt",
...
}

令牌 scope 包括https://www.googleapis.com/auth/drive.file https://www.googleapis.com/auth/drive.appdata

使用Android SDK也面临同样的问题。

任何帮助,将不胜感激。

来自files.list的结果是分页的-您的响应应包含“ nextPageToken”字段,并且您将不得不再次致电下一页结果。 请参阅此处有关文件列表调用的文档。 您可能想使用其中一个客户端库进行此调用(请参阅页面底部的示例)

尝试获取 Google 云端硬盘文件夹中的文件列表时,我遇到了同样的问题。 这个文件夹有5000多个文件,但是API只返回其中两个。 问题是——当文件夹中的文件通过链接与任何人共享时,实际上只有在您打开它后才会与您共享。 此文件夹的所有者必须将您指定为查看者。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM