以下请求按预期返回每个文件的“parents”字段:
REQUEST
GET https://www.googleapis.com/drive/v3/files?corpora=teamDrive&includeTeamDriveItems=true&q=(mimeType+contains+%22document%22)+and+(trashed+%3D+false)&supportsTeamDrives=true&teamDriveId=0AF36YeSWsu3dUk9PVA&fields=files(headRevisionId%2Cid%2Cparents)&key={YOUR_API_KEY}
RESPONSE
{
"files": [
{
"id": "1pULO-raKOEE2gHawEEd89UdKYqvX1cwFPYHwrJ9kgn4",
"parents": [
"0Bwy7SlKkxnwQRld6RWljU0Y4TG8"
]
},
{
"id": "1A1lyNy_ZRfyaYrpqLtY-DiuOH_Wh2-qso4pml8zceN0",
"parents": [
"0B4jAnSzS-VxlLTA4WWtIdkJ2NGs"
]
},
{
"id": "1yYnu_LQF71_2hbsHFjylyXl_71oT9xw3BymtdQj9DWM",
"parents": [
"0B4jAnSzS-VxlLTFEaktzX1BjNW8"
]
},
{
"id": "1ln2anvndwQ6PQUe3OLwaQH3T8lvDTX0o-TeY3SaG5Kg",
"parents": [
"0B4jAnSzS-VxlSFd5UERwMTY1Ym8"
]
}
]
}
如果我从请求中删除“headRevisionId”字段,我也会从4个文件中的3个文件的响应中丢失“父母”字段:
REQUEST
GET https://www.googleapis.com/drive/v3/files?corpora=teamDrive&includeTeamDriveItems=true&q=(mimeType+contains+%22document%22)+and+(trashed+%3D+false)&supportsTeamDrives=true&teamDriveId=0AF36YeSWsu3dUk9PVA&fields=files(id%2Cparents)&key={YOUR_API_KEY}
RESPONSE
{
"files": [
{
"id": "1pULO-raKOEE2gHawEEd89UdKYqvX1cwFPYHwrJ9kgn4",
"parents": [
"0Bwy7SlKkxnwQRld6RWljU0Y4TG8"
]
},
{
"id": "1A1lyNy_ZRfyaYrpqLtY-DiuOH_Wh2-qso4pml8zceN0"
},
{
"id": "1yYnu_LQF71_2hbsHFjylyXl_71oT9xw3BymtdQj9DWM"
},
{
"id": "1ln2anvndwQ6PQUe3OLwaQH3T8lvDTX0o-TeY3SaG5Kg"
}
]
}
我不知道为什么会这样。这些文件位于Team Drive上。我有团队访问权限可以查看/编辑所有这些文档。在第二个请求中可见“父母”字段的唯一文件是我个人创建的文档。这为什么重要?当且仅当“headRevisionId”也是请求的一部分时,我才能看到“父母”。谁能解释一下?
谢谢, 香农