【发布时间】:2021-01-21 07:22:49
【问题描述】:
我正在尝试使用 GDrive API v3 列出快捷方式文件夹中的所有文件和文件夹。
使用 API 时,我可以使用以下请求列出所有文件:
curl \
'https://www.googleapis.com/drive/v3/files?q=%27root%27%20in%20parents&supportsAllDrives=true&supportsTeamDrives=true&key=[YOUR_API_KEY]' \
--header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
--header 'Accept: application/json' \
--compressed
返回类似:
{
"kind": "drive#file",
"id": "xxxxxxxxxxxxxx",
"name": "Name of file here",
"mimeType": "application/vnd.google-apps.shortcut"
}
当我获取该 ID 并在上面的相同请求中使用它时,它适用于 "mimeType": "application/vnd.google-apps.folder"。我得到一个空的有效载荷:
{
"kind": "drive#fileList",
"incompleteSearch": false,
"files": []
}
我是否使用了错误的端点?我还需要向 API 请求添加其他内容吗?
【问题讨论】:
-
文件夹的 mimetype 是 application/vnd.google-apps.folder
标签: google-api google-drive-api gdrive