Google drive api 删除空共享驱动器失败
正在尝试删除共享驱动器[1]。请求返回403禁止 以及以下机构:Google drive api 删除空共享驱动器失败,google-drive-api,Google Drive Api,正在尝试删除共享驱动器[1]。请求返回403禁止 以及以下机构: { "error": { "errors": [ { "domain": "global", "reason": "cannotDeleteResourceWithChildren", "message": "This resource cannot be deleted because it has children." } ], "code": 403, "message"
{
"error": {
"errors": [
{
"domain": "global",
"reason": "cannotDeleteResourceWithChildren",
"message": "This resource cannot be deleted because it has children."
}
],
"code": 403,
"message": "This resource cannot be deleted because it has children."
}
}
然而,驱动器是空的。前一个列表请求返回了一个空列表
几秒钟后再次发出相同的删除请求是成功的
编辑:忘记提及在列表请求之前删除了一个文件(发送到垃圾箱)
复制的步骤是:
- 将共享驱动器下的文件发送到垃圾箱李>
- 列出请求。它返回一个空列表李>
- 删除共享驱动器请求
DRIVEID=0ANMOBifriUr9Uk9PVA
curl "https://content.googleapis.com/drive/v3/files?corpora=drive&driveId=$DRIVEID&includeItemsFromAllDrives=true&q=trashed%3Dfalse&supportsAllDrives=true&fields=files(id%2Cname)" -H 'sec-fetch-mode: cors' -H 'x-goog-encode-response-if-executable: base64' -H 'accept-encoding: gzip, deflate, br' -H 'x-origin: https://explorer.apis.google.com' -H 'accept-language: en-US,en;q=0.9' -H 'authorization: Bearer AuthToken0' -H 'x-requested-with: XMLHttpRequest' -H 'x-clientdetails: appVersion=5.0%20(Windows%20NT%2010.0%3B%20Win64%3B%20x64)%20AppleWebKit%2F537.36%20(KHTML%2C%20like%20Gecko)%20Chrome%2F77.0.3829.0%20Safari%2F537.36%20Edg%2F77.0.197.1&platform=Win32&userAgent=Mozilla%2F5.0%20(Windows%20NT%2010.0%3B%20Win64%3B%20x64)%20AppleWebKit%2F537.36%20(KHTML%2C%20like%20Gecko)%20Chrome%2F77.0.3829.0%20Safari%2F537.36%20Edg%2F77.0.197.1' -H 'x-javascript-user-agent: apix/3.0.0 google-api-javascript-client/1.1.0' -H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3829.0 Safari/537.36 Edg/77.0.197.1' -H 'accept: */*' -H 'referer: https://content.googleapis.com/static/proxy.html?usegapi=1&jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.pt_BR.9VS-OXqJJxY.O%2Fam%3DwQE%2Fd%3D1%2Frs%3DAGLTcCOat2vY5WjTVOTl0GbC_09htXr7UQ%2Fm%3D__features__' -H 'authority: content.googleapis.com' -H 'sec-fetch-site: same-origin' -H 'x-referer: https://explorer.apis.google.com' --compressed
curl 'https://content.googleapis.com/drive/v3/files/1fkLANZMuX7Tl_6rTQgqFV6x2St48UcVo?supportsAllDrives=true&alt=json' -X PATCH -H 'sec-fetch-mode: cors' -H 'x-goog-encode-response-if-executable: base64' -H 'accept-encoding: gzip, deflate, br' -H 'x-origin: https://explorer.apis.google.com' -H 'accept-language: en-US,en;q=0.9' -H 'authorization: Bearer AuthToken' -H 'x-requested-with: XMLHttpRequest' -H 'sec-fetch-site: same-origin' -H 'x-clientdetails: appVersion=5.0%20(Windows%20NT%2010.0%3B%20Win64%3B%20x64)%20AppleWebKit%2F537.36%20(KHTML%2C%20like%20Gecko)%20Chrome%2F77.0.3829.0%20Safari%2F537.36%20Edg%2F77.0.197.1&platform=Win32&userAgent=Mozilla%2F5.0%20(Windows%20NT%2010.0%3B%20Win64%3B%20x64)%20AppleWebKit%2F537.36%20(KHTML%2C%20like%20Gecko)%20Chrome%2F77.0.3829.0%20Safari%2F537.36%20Edg%2F77.0.197.1' -H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3829.0 Safari/537.36 Edg/77.0.197.1' -H 'content-type: application/json' -H 'accept: */*' -H 'referer: https://content.googleapis.com/static/proxy.html?usegapi=1&jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.pt_BR.9VS-OXqJJxY.O%2Fam%3DwQE%2Fd%3D1%2Frs%3DAGLTcCOat2vY5WjTVOTl0GbC_09htXr7UQ%2Fm%3D__features__' -H 'authority: content.googleapis.com' -H 'x-javascript-user-agent: apix/3.0.0 google-api-javascript-client/1.1.0' -H 'x-referer: https://explorer.apis.google.com' -H 'origin: https://content.googleapis.com' --data-binary '{"trashed":true}' --compressed
curl 'https://content.googleapis.com/drive/v3/files/1dVyvc8x9hqRSG81gbzH7QlXdy9pVPOpF?supportsAllDrives=true&alt=json' -X PATCH -H 'sec-fetch-mode: cors' -H 'x-goog-encode-response-if-executable: base64' -H 'accept-encoding: gzip, deflate, br' -H 'x-origin: https://explorer.apis.google.com' -H 'accept-language: en-US,en;q=0.9' -H 'authorization: Bearer AuthToken' -H 'x-requested-with: XMLHttpRequest' -H 'sec-fetch-site: same-origin' -H 'x-clientdetails: appVersion=5.0%20(Windows%20NT%2010.0%3B%20Win64%3B%20x64)%20AppleWebKit%2F537.36%20(KHTML%2C%20like%20Gecko)%20Chrome%2F77.0.3829.0%20Safari%2F537.36%20Edg%2F77.0.197.1&platform=Win32&userAgent=Mozilla%2F5.0%20(Windows%20NT%2010.0%3B%20Win64%3B%20x64)%20AppleWebKit%2F537.36%20(KHTML%2C%20like%20Gecko)%20Chrome%2F77.0.3829.0%20Safari%2F537.36%20Edg%2F77.0.197.1' -H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3829.0 Safari/537.36 Edg/77.0.197.1' -H 'content-type: application/json' -H 'accept: */*' -H 'referer: https://content.googleapis.com/static/proxy.html?usegapi=1&jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.pt_BR.9VS-OXqJJxY.O%2Fam%3DwQE%2Fd%3D1%2Frs%3DAGLTcCOat2vY5WjTVOTl0GbC_09htXr7UQ%2Fm%3D__features__' -H 'authority: content.googleapis.com' -H 'x-javascript-user-agent: apix/3.0.0 google-api-javascript-client/1.1.0' -H 'x-referer: https://explorer.apis.google.com' -H 'origin: https://content.googleapis.com' --data-binary '{"trashed":true}' --compressed
curl 'https://content.googleapis.com/drive/v3/files/1XNte7tA6g95YOdM4Kfrr-YWs3-c6WtOZ?supportsAllDrives=true&alt=json' -X PATCH -H 'sec-fetch-mode: cors' -H 'x-goog-encode-response-if-executable: base64' -H 'accept-encoding: gzip, deflate, br' -H 'x-origin: https://explorer.apis.google.com' -H 'accept-language: en-US,en;q=0.9' -H 'authorization: Bearer AuthToken' -H 'x-requested-with: XMLHttpRequest' -H 'sec-fetch-site: same-origin' -H 'x-clientdetails: appVersion=5.0%20(Windows%20NT%2010.0%3B%20Win64%3B%20x64)%20AppleWebKit%2F537.36%20(KHTML%2C%20like%20Gecko)%20Chrome%2F77.0.3829.0%20Safari%2F537.36%20Edg%2F77.0.197.1&platform=Win32&userAgent=Mozilla%2F5.0%20(Windows%20NT%2010.0%3B%20Win64%3B%20x64)%20AppleWebKit%2F537.36%20(KHTML%2C%20like%20Gecko)%20Chrome%2F77.0.3829.0%20Safari%2F537.36%20Edg%2F77.0.197.1' -H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3829.0 Safari/537.36 Edg/77.0.197.1' -H 'content-type: application/json' -H 'accept: */*' -H 'referer: https://content.googleapis.com/static/proxy.html?usegapi=1&jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.pt_BR.9VS-OXqJJxY.O%2Fam%3DwQE%2Fd%3D1%2Frs%3DAGLTcCOat2vY5WjTVOTl0GbC_09htXr7UQ%2Fm%3D__features__' -H 'authority: content.googleapis.com' -H 'x-javascript-user-agent: apix/3.0.0 google-api-javascript-client/1.1.0' -H 'x-referer: https://explorer.apis.google.com' -H 'origin: https://content.googleapis.com' --data-binary '{"trashed":true}' --compressed
curl 'https://content.googleapis.com/drive/v3/files/1pQ52Qya4qv9TzvV4MxnXcXZBzlbsc3Ky?supportsAllDrives=true&alt=json' -X PATCH -H 'sec-fetch-mode: cors' -H 'x-goog-encode-response-if-executable: base64' -H 'accept-encoding: gzip, deflate, br' -H 'x-origin: https://explorer.apis.google.com' -H 'accept-language: en-US,en;q=0.9' -H 'authorization: Bearer AuthToken' -H 'x-requested-with: XMLHttpRequest' -H 'sec-fetch-site: same-origin' -H 'x-clientdetails: appVersion=5.0%20(Windows%20NT%2010.0%3B%20Win64%3B%20x64)%20AppleWebKit%2F537.36%20(KHTML%2C%20like%20Gecko)%20Chrome%2F77.0.3829.0%20Safari%2F537.36%20Edg%2F77.0.197.1&platform=Win32&userAgent=Mozilla%2F5.0%20(Windows%20NT%2010.0%3B%20Win64%3B%20x64)%20AppleWebKit%2F537.36%20(KHTML%2C%20like%20Gecko)%20Chrome%2F77.0.3829.0%20Safari%2F537.36%20Edg%2F77.0.197.1' -H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3829.0 Safari/537.36 Edg/77.0.197.1' -H 'content-type: application/json' -H 'accept: */*' -H 'referer: https://content.googleapis.com/static/proxy.html?usegapi=1&jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.pt_BR.9VS-OXqJJxY.O%2Fam%3DwQE%2Fd%3D1%2Frs%3DAGLTcCOat2vY5WjTVOTl0GbC_09htXr7UQ%2Fm%3D__features__' -H 'authority: content.googleapis.com' -H 'x-javascript-user-agent: apix/3.0.0 google-api-javascript-client/1.1.0' -H 'x-referer: https://explorer.apis.google.com' -H 'origin: https://content.googleapis.com' --data-binary '{"trashed":true}' --compressed
curl 'https://content.googleapis.com/drive/v3/files/1ymmxdvHlqZTggK2H5WxAYLYMTwwmh-26?supportsAllDrives=true&alt=json' -X PATCH -H 'sec-fetch-mode: cors' -H 'x-goog-encode-response-if-executable: base64' -H 'accept-encoding: gzip, deflate, br' -H 'x-origin: https://explorer.apis.google.com' -H 'accept-language: en-US,en;q=0.9' -H 'authorization: Bearer AuthToken' -H 'x-requested-with: XMLHttpRequest' -H 'sec-fetch-site: same-origin' -H 'x-clientdetails: appVersion=5.0%20(Windows%20NT%2010.0%3B%20Win64%3B%20x64)%20AppleWebKit%2F537.36%20(KHTML%2C%20like%20Gecko)%20Chrome%2F77.0.3829.0%20Safari%2F537.36%20Edg%2F77.0.197.1&platform=Win32&userAgent=Mozilla%2F5.0%20(Windows%20NT%2010.0%3B%20Win64%3B%20x64)%20AppleWebKit%2F537.36%20(KHTML%2C%20like%20Gecko)%20Chrome%2F77.0.3829.0%20Safari%2F537.36%20Edg%2F77.0.197.1' -H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3829.0 Safari/537.36 Edg/77.0.197.1' -H 'content-type: application/json' -H 'accept: */*' -H 'referer: https://content.googleapis.com/static/proxy.html?usegapi=1&jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.pt_BR.9VS-OXqJJxY.O%2Fam%3DwQE%2Fd%3D1%2Frs%3DAGLTcCOat2vY5WjTVOTl0GbC_09htXr7UQ%2Fm%3D__features__' -H 'authority: content.googleapis.com' -H 'x-javascript-user-agent: apix/3.0.0 google-api-javascript-client/1.1.0' -H 'x-referer: https://explorer.apis.google.com' -H 'origin: https://content.googleapis.com' --data-binary '{"trashed":true}' --compressed
curl 'https://content.googleapis.com/drive/v3/files/1fhwOPeobj_1MRo_eaY-c_MQ2B44LVc3Z?supportsAllDrives=true&alt=json' -X PATCH -H 'sec-fetch-mode: cors' -H 'x-goog-encode-response-if-executable: base64' -H 'accept-encoding: gzip, deflate, br' -H 'x-origin: https://explorer.apis.google.com' -H 'accept-language: en-US,en;q=0.9' -H 'authorization: Bearer AuthToken' -H 'x-requested-with: XMLHttpRequest' -H 'sec-fetch-site: same-origin' -H 'x-clientdetails: appVersion=5.0%20(Windows%20NT%2010.0%3B%20Win64%3B%20x64)%20AppleWebKit%2F537.36%20(KHTML%2C%20like%20Gecko)%20Chrome%2F77.0.3829.0%20Safari%2F537.36%20Edg%2F77.0.197.1&platform=Win32&userAgent=Mozilla%2F5.0%20(Windows%20NT%2010.0%3B%20Win64%3B%20x64)%20AppleWebKit%2F537.36%20(KHTML%2C%20like%20Gecko)%20Chrome%2F77.0.3829.0%20Safari%2F537.36%20Edg%2F77.0.197.1' -H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3829.0 Safari/537.36 Edg/77.0.197.1' -H 'content-type: application/json' -H 'accept: */*' -H 'referer: https://content.googleapis.com/static/proxy.html?usegapi=1&jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.pt_BR.9VS-OXqJJxY.O%2Fam%3DwQE%2Fd%3D1%2Frs%3DAGLTcCOat2vY5WjTVOTl0GbC_09htXr7UQ%2Fm%3D__features__' -H 'authority: content.googleapis.com' -H 'x-javascript-user-agent: apix/3.0.0 google-api-javascript-client/1.1.0' -H 'x-referer: https://explorer.apis.google.com' -H 'origin: https://content.googleapis.com' --data-binary '{"trashed":true}' --compressed
curl 'https://content.googleapis.com/drive/v3/files/1st_wpikySnsAdikUDePGqbo4bDQTEynl?supportsAllDrives=true&alt=json' -X PATCH -H 'sec-fetch-mode: cors' -H 'x-goog-encode-response-if-executable: base64' -H 'accept-encoding: gzip, deflate, br' -H 'x-origin: https://explorer.apis.google.com' -H 'accept-language: en-US,en;q=0.9' -H 'authorization: Bearer AuthToken' -H 'x-requested-with: XMLHttpRequest' -H 'sec-fetch-site: same-origin' -H 'x-clientdetails: appVersion=5.0%20(Windows%20NT%2010.0%3B%20Win64%3B%20x64)%20AppleWebKit%2F537.36%20(KHTML%2C%20like%20Gecko)%20Chrome%2F77.0.3829.0%20Safari%2F537.36%20Edg%2F77.0.197.1&platform=Win32&userAgent=Mozilla%2F5.0%20(Windows%20NT%2010.0%3B%20Win64%3B%20x64)%20AppleWebKit%2F537.36%20(KHTML%2C%20like%20Gecko)%20Chrome%2F77.0.3829.0%20Safari%2F537.36%20Edg%2F77.0.197.1' -H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3829.0 Safari/537.36 Edg/77.0.197.1' -H 'content-type: application/json' -H 'accept: */*' -H 'referer: https://content.googleapis.com/static/proxy.html?usegapi=1&jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.pt_BR.9VS-OXqJJxY.O%2Fam%3DwQE%2Fd%3D1%2Frs%3DAGLTcCOat2vY5WjTVOTl0GbC_09htXr7UQ%2Fm%3D__features__' -H 'authority: content.googleapis.com' -H 'x-javascript-user-agent: apix/3.0.0 google-api-javascript-client/1.1.0' -H 'x-referer: https://explorer.apis.google.com' -H 'origin: https://content.googleapis.com' --data-binary '{"trashed":true}' --compressed
curl 'https://content.googleapis.com/drive/v3/files/1xKpaojPrgqcwWgwCbWse2KGgVwjC7SaW?supportsAllDrives=true&alt=json' -X PATCH -H 'sec-fetch-mode: cors' -H 'x-goog-encode-response-if-executable: base64' -H 'accept-encoding: gzip, deflate, br' -H 'x-origin: https://explorer.apis.google.com' -H 'accept-language: en-US,en;q=0.9' -H 'authorization: Bearer AuthToken' -H 'x-requested-with: XMLHttpRequest' -H 'sec-fetch-site: same-origin' -H 'x-clientdetails: appVersion=5.0%20(Windows%20NT%2010.0%3B%20Win64%3B%20x64)%20AppleWebKit%2F537.36%20(KHTML%2C%20like%20Gecko)%20Chrome%2F77.0.3829.0%20Safari%2F537.36%20Edg%2F77.0.197.1&platform=Win32&userAgent=Mozilla%2F5.0%20(Windows%20NT%2010.0%3B%20Win64%3B%20x64)%20AppleWebKit%2F537.36%20(KHTML%2C%20like%20Gecko)%20Chrome%2F77.0.3829.0%20Safari%2F537.36%20Edg%2F77.0.197.1' -H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3829.0 Safari/537.36 Edg/77.0.197.1' -H 'content-type: application/json' -H 'accept: */*' -H 'referer: https://content.googleapis.com/static/proxy.html?usegapi=1&jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.pt_BR.9VS-OXqJJxY.O%2Fam%3DwQE%2Fd%3D1%2Frs%3DAGLTcCOat2vY5WjTVOTl0GbC_09htXr7UQ%2Fm%3D__features__' -H 'authority: content.googleapis.com' -H 'x-javascript-user-agent: apix/3.0.0 google-api-javascript-client/1.1.0' -H 'x-referer: https://explorer.apis.google.com' -H 'origin: https://content.googleapis.com' --data-binary '{"trashed":true}' --compressed
curl 'https://content.googleapis.com/drive/v3/files/1btL_jLjrUg3oO3y2275lcq2T5VxmESuM?supportsAllDrives=true&alt=json' -X PATCH -H 'sec-fetch-mode: cors' -H 'x-goog-encode-response-if-executable: base64' -H 'accept-encoding: gzip, deflate, br' -H 'x-origin: https://explorer.apis.google.com' -H 'accept-language: en-US,en;q=0.9' -H 'authorization: Bearer AuthToken' -H 'x-requested-with: XMLHttpRequest' -H 'sec-fetch-site: same-origin' -H 'x-clientdetails: appVersion=5.0%20(Windows%20NT%2010.0%3B%20Win64%3B%20x64)%20AppleWebKit%2F537.36%20(KHTML%2C%20like%20Gecko)%20Chrome%2F77.0.3829.0%20Safari%2F537.36%20Edg%2F77.0.197.1&platform=Win32&userAgent=Mozilla%2F5.0%20(Windows%20NT%2010.0%3B%20Win64%3B%20x64)%20AppleWebKit%2F537.36%20(KHTML%2C%20like%20Gecko)%20Chrome%2F77.0.3829.0%20Safari%2F537.36%20Edg%2F77.0.197.1' -H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3829.0 Safari/537.36 Edg/77.0.197.1' -H 'content-type: application/json' -H 'accept: */*' -H 'referer: https://content.googleapis.com/static/proxy.html?usegapi=1&jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.pt_BR.9VS-OXqJJxY.O%2Fam%3DwQE%2Fd%3D1%2Frs%3DAGLTcCOat2vY5WjTVOTl0GbC_09htXr7UQ%2Fm%3D__features__' -H 'authority: content.googleapis.com' -H 'x-javascript-user-agent: apix/3.0.0 google-api-javascript-client/1.1.0' -H 'x-referer: https://explorer.apis.google.com' -H 'origin: https://content.googleapis.com' --data-binary '{"trashed":true}' --compressed
curl 'https://content.googleapis.com/drive/v3/files/1TBypd04jm7s3gVo0fc61hs4Gx7Uo4E0Y?supportsAllDrives=true&alt=json' -X PATCH -H 'sec-fetch-mode: cors' -H 'x-goog-encode-response-if-executable: base64' -H 'accept-encoding: gzip, deflate, br' -H 'x-origin: https://explorer.apis.google.com' -H 'accept-language: en-US,en;q=0.9' -H 'authorization: Bearer AuthToken' -H 'x-requested-with: XMLHttpRequest' -H 'sec-fetch-site: same-origin' -H 'x-clientdetails: appVersion=5.0%20(Windows%20NT%2010.0%3B%20Win64%3B%20x64)%20AppleWebKit%2F537.36%20(KHTML%2C%20like%20Gecko)%20Chrome%2F77.0.3829.0%20Safari%2F537.36%20Edg%2F77.0.197.1&platform=Win32&userAgent=Mozilla%2F5.0%20(Windows%20NT%2010.0%3B%20Win64%3B%20x64)%20AppleWebKit%2F537.36%20(KHTML%2C%20like%20Gecko)%20Chrome%2F77.0.3829.0%20Safari%2F537.36%20Edg%2F77.0.197.1' -H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3829.0 Safari/537.36 Edg/77.0.197.1' -H 'content-type: application/json' -H 'accept: */*' -H 'referer: https://content.googleapis.com/static/proxy.html?usegapi=1&jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.pt_BR.9VS-OXqJJxY.O%2Fam%3DwQE%2Fd%3D1%2Frs%3DAGLTcCOat2vY5WjTVOTl0GbC_09htXr7UQ%2Fm%3D__features__' -H 'authority: content.googleapis.com' -H 'x-javascript-user-agent: apix/3.0.0 google-api-javascript-client/1.1.0' -H 'x-referer: https://explorer.apis.google.com' -H 'origin: https://content.googleapis.com' --data-binary '{"trashed":true}' --compressed
curl "https://content.googleapis.com/drive/v3/files?corpora=drive&driveId=$DRIVEID&includeItemsFromAllDrives=true&q=trashed%3Dfalse&supportsAllDrives=true&fields=files(id%2Cname)" -H 'sec-fetch-mode: cors' -H 'x-goog-encode-response-if-executable: base64' -H 'accept-encoding: gzip, deflate, br' -H 'x-origin: https://explorer.apis.google.com' -H 'accept-language: en-US,en;q=0.9' -H 'authorization: Bearer AuthToken2' -H 'x-requested-with: XMLHttpRequest' -H 'x-clientdetails: appVersion=5.0%20(Windows%20NT%2010.0%3B%20Win64%3B%20x64)%20AppleWebKit%2F537.36%20(KHTML%2C%20like%20Gecko)%20Chrome%2F77.0.3829.0%20Safari%2F537.36%20Edg%2F77.0.197.1&platform=Win32&userAgent=Mozilla%2F5.0%20(Windows%20NT%2010.0%3B%20Win64%3B%20x64)%20AppleWebKit%2F537.36%20(KHTML%2C%20like%20Gecko)%20Chrome%2F77.0.3829.0%20Safari%2F537.36%20Edg%2F77.0.197.1' -H 'x-javascript-user-agent: apix/3.0.0 google-api-javascript-client/1.1.0' -H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3829.0 Safari/537.36 Edg/77.0.197.1' -H 'accept: */*' -H 'referer: https://content.googleapis.com/static/proxy.html?usegapi=1&jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.pt_BR.9VS-OXqJJxY.O%2Fam%3DwQE%2Fd%3D1%2Frs%3DAGLTcCOat2vY5WjTVOTl0GbC_09htXr7UQ%2Fm%3D__features__' -H 'authority: content.googleapis.com' -H 'sec-fetch-site: same-origin' -H 'x-referer: https://explorer.apis.google.com' --compressed
curl "https://content.googleapis.com/drive/v3/drives/$DRIVEID" -X DELETE -H 'sec-fetch-mode: cors' -H 'x-goog-encode-response-if-executable: base64' -H 'accept-encoding: gzip, deflate, br' -H 'x-origin: https://explorer.apis.google.com' -H 'accept-language: en-US,en;q=0.9' -H 'authorization: Bearer AuthToken3' -H 'x-requested-with: XMLHttpRequest' -H 'x-clientdetails: appVersion=5.0%20(Windows%20NT%2010.0%3B%20Win64%3B%20x64)%20AppleWebKit%2F537.36%20(KHTML%2C%20like%20Gecko)%20Chrome%2F77.0.3829.0%20Safari%2F537.36%20Edg%2F77.0.197.1&platform=Win32&userAgent=Mozilla%2F5.0%20(Windows%20NT%2010.0%3B%20Win64%3B%20x64)%20AppleWebKit%2F537.36%20(KHTML%2C%20like%20Gecko)%20Chrome%2F77.0.3829.0%20Safari%2F537.36%20Edg%2F77.0.197.1' -H 'x-javascript-user-agent: apix/3.0.0 google-api-javascript-client/1.1.0' -H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3829.0 Safari/537.36 Edg/77.0.197.1' -H 'accept: */*' -H 'referer: https://content.googleapis.com/static/proxy.html?usegapi=1&jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.pt_BR.9VS-OXqJJxY.O%2Fam%3DwQE%2Fd%3D1%2Frs%3DAGLTcCOat2vY5WjTVOTl0GbC_09htXr7UQ%2Fm%3D__features__' -H 'authority: content.googleapis.com' -H 'sec-fetch-site: same-origin' -H 'x-referer: https://explorer.apis.google.com' -H 'origin: https://content.googleapis.com' --compressed
这是输出
{
"files": [
{
"id": "1fkLANZMuX7Tl_6rTQgqFV6x2St48UcVo",
"name": "file-0010"
},
{
"id": "1dVyvc8x9hqRSG81gbzH7QlXdy9pVPOpF",
"name": "file-0005"
},
{
"id": "1XNte7tA6g95YOdM4Kfrr-YWs3-c6WtOZ",
"name": "file-0004"
},
{
"id": "1pQ52Qya4qv9TzvV4MxnXcXZBzlbsc3Ky",
"name": "file-0002"
},
{
"id": "1ymmxdvHlqZTggK2H5WxAYLYMTwwmh-26",
"name": "file-0003"
},
{
"id": "1fhwOPeobj_1MRo_eaY-c_MQ2B44LVc3Z",
"name": "file-0001"
},
{
"id": "1st_wpikySnsAdikUDePGqbo4bDQTEynl",
"name": "file-0008"
},
{
"id": "1xKpaojPrgqcwWgwCbWse2KGgVwjC7SaW",
"name": "file-0007"
},
{
"id": "1btL_jLjrUg3oO3y2275lcq2T5VxmESuM",
"name": "file-0006"
},
{
"id": "1TBypd04jm7s3gVo0fc61hs4Gx7Uo4E0Y",
"name": "file-0009"
}
]
}
{
"kind": "drive#file",
"id": "1fkLANZMuX7Tl_6rTQgqFV6x2St48UcVo",
"name": "file-0010",
"mimeType": "application/octet-stream",
"teamDriveId": "0ANMOBifriUr9Uk9PVA",
"driveId": "0ANMOBifriUr9Uk9PVA"
}
{
"kind": "drive#file",
"id": "1dVyvc8x9hqRSG81gbzH7QlXdy9pVPOpF",
"name": "file-0005",
"mimeType": "application/octet-stream",
"teamDriveId": "0ANMOBifriUr9Uk9PVA",
"driveId": "0ANMOBifriUr9Uk9PVA"
}
{
"kind": "drive#file",
"id": "1XNte7tA6g95YOdM4Kfrr-YWs3-c6WtOZ",
"name": "file-0004",
"mimeType": "application/octet-stream",
"teamDriveId": "0ANMOBifriUr9Uk9PVA",
"driveId": "0ANMOBifriUr9Uk9PVA"
}
{
"kind": "drive#file",
"id": "1pQ52Qya4qv9TzvV4MxnXcXZBzlbsc3Ky",
"name": "file-0002",
"mimeType": "application/octet-stream",
"teamDriveId": "0ANMOBifriUr9Uk9PVA",
"driveId": "0ANMOBifriUr9Uk9PVA"
}
{
"kind": "drive#file",
"id": "1ymmxdvHlqZTggK2H5WxAYLYMTwwmh-26",
"name": "file-0003",
"mimeType": "application/octet-stream",
"teamDriveId": "0ANMOBifriUr9Uk9PVA",
"driveId": "0ANMOBifriUr9Uk9PVA"
}
{
"kind": "drive#file",
"id": "1fhwOPeobj_1MRo_eaY-c_MQ2B44LVc3Z",
"name": "file-0001",
"mimeType": "application/octet-stream",
"teamDriveId": "0ANMOBifriUr9Uk9PVA",
"driveId": "0ANMOBifriUr9Uk9PVA"
}
{
"kind": "drive#file",
"id": "1st_wpikySnsAdikUDePGqbo4bDQTEynl",
"name": "file-0008",
"mimeType": "application/octet-stream",
"teamDriveId": "0ANMOBifriUr9Uk9PVA",
"driveId": "0ANMOBifriUr9Uk9PVA"
}
{
"kind": "drive#file",
"id": "1xKpaojPrgqcwWgwCbWse2KGgVwjC7SaW",
"name": "file-0007",
"mimeType": "application/octet-stream",
"teamDriveId": "0ANMOBifriUr9Uk9PVA",
"driveId": "0ANMOBifriUr9Uk9PVA"
}
{
"kind": "drive#file",
"id": "1btL_jLjrUg3oO3y2275lcq2T5VxmESuM",
"name": "file-0006",
"mimeType": "application/octet-stream",
"teamDriveId": "0ANMOBifriUr9Uk9PVA",
"driveId": "0ANMOBifriUr9Uk9PVA"
}
{
"kind": "drive#file",
"id": "1TBypd04jm7s3gVo0fc61hs4Gx7Uo4E0Y",
"name": "file-0009",
"mimeType": "application/octet-stream",
"teamDriveId": "0ANMOBifriUr9Uk9PVA",
"driveId": "0ANMOBifriUr9Uk9PVA"
}
{
"files": []
}
{
"error": {
"errors": [
{
"domain": "global",
"reason": "cannotDeleteResourceWithChildren",
"message": "This resource cannot be deleted because it has children."
}
],
"code": 403,
"message": "This resource cannot be deleted because it has children."
}
}
特别有趣的是最后两个响应:[2]返回一个空列表
{
"files": []
}
但是[1]给出了错误
{
"error": {
"errors": [
{
"domain": "global",
"reason": "cannotDeleteResourceWithChildren",
"message": "This resource cannot be deleted because it has children."
}
],
"code": 403,
"message": "This resource cannot be deleted because it has children."
}
}
这里的问题是,当你丢弃一个文件时,它仍然链接到它被丢弃的驱动器,因此如果你需要,它可以在以后恢复。仅将
trashed
属性更新为True
不会删除文件与父驱动器之间的链接
您可以在此处执行几项操作-您可以废弃文件,然后使用更改链接的父级,确保使用以下参数:
fileId = 'ID of file'
supportsAllDrives = True
addParents = 'Drive ID of different Drive'
removeParents = 'ID of Shared Drive you want to delete'
fileId = 'ID of file'
supportsAllDrives = True
文件必须至少有一个父链接,因此在删除共享驱动器链接之前需要添加新链接
另一个选项是直接删除文件,而不是将其发送到垃圾箱-仅当您确定不必恢复文件时才执行此操作,因为这样做时无法恢复文件。这是使用方法完成的,同样需要使用以下参数:
fileId = 'ID of file'
supportsAllDrives = True
addParents = 'Drive ID of different Drive'
removeParents = 'ID of Shared Drive you want to delete'
fileId = 'ID of file'
supportsAllDrives = True
允许您使用该方法删除驱动器。这里的问题是,当您丢弃文件时,它仍然链接到从中丢弃文件的驱动器,以便在需要时可以在以后恢复。仅将
trashed
属性更新为True
不会删除文件与父驱动器之间的链接
您可以在此处执行几项操作-您可以废弃文件,然后使用更改链接的父级,确保使用以下参数:
fileId = 'ID of file'
supportsAllDrives = True
addParents = 'Drive ID of different Drive'
removeParents = 'ID of Shared Drive you want to delete'
fileId = 'ID of file'
supportsAllDrives = True
文件必须至少有一个父链接,因此在删除共享驱动器链接之前需要添加新链接
另一个选项是直接删除文件,而不是将其发送到垃圾箱-仅当您确定不必恢复文件时才执行此操作,因为这样做时无法恢复文件。这是使用方法完成的,同样需要使用以下参数:
fileId = 'ID of file'
supportsAllDrives = True
addParents = 'Drive ID of different Drive'
removeParents = 'ID of Shared Drive you want to delete'
fileId = 'ID of file'
supportsAllDrives = True
允许您随后使用该方法删除驱动器。您可以分享您尝试执行此操作的代码吗?@RafaGuillermo不幸没有。源已关闭。但我能用cURL复制它。你能分享一下你尝试过的代码吗?@RafaGuillermo不幸的是,不能。源已关闭。但我能用cURL复制它。