我正在尝试使用Google Drive SDK将Google云端硬盘中的所有数据下载到本地文件夹中。大多数文档都是在没有任何问题的情但有一些文件有奇怪的错误。
首先,所有这些文件都列在Files: list
结果中。 Files: get
会返回有关这些文件的信息。
我看到这些文件归我用来下载文档的用户所有:
[userPermission] => Google_Permission Object
(
[withLink] =>
[kind] => drive#permission
[name] =>
[value] =>
[id] => me
[authKey] =>
[etag] => "I8bbqc4qdR0X_1JlJgkO3gbuFf8/HQBSku0dMcS5bNfsSFuNdlHwJmk"
[role] => owner
[photoLink] =>
[type] => user
[additionalRoles] =>
[selfLink] => https://www.googleapis.com/drive/v2/files/..../permissions/me
)
但是当我尝试使用exportLinks
之一导出这些文件时,我收到了错误。
文件:
Sorry, the file you have requested does not exist.
电子表格:
Spreadsheet not found
Error 404
在其他帐户上,我收到HTTP状态401错误:
Permission denied
Error 401
最后,HTTP Status 500存在很多错误:
Conversion failed unexpectedly
Error 500
主要问题 - 我可以解决这些问题吗?如果没有我可以向用户说明这些问题?
401 Permission denied
的可能性如何?更新1:当我尝试导出时,它总是返回401
{
"mimeType": "application/vnd.google-apps.spreadsheet",
"thumbnailLink": null,
"labels": {
"restricted": false,
"hidden": false,
"viewed": false,
"starred": false,
"trashed": false
},
"indexableText": null,
"explicitlyTrashed": null,
"etag": "\"KYLl3b7q6n8KW2kbVvK9NFUdVkc/MTM4MjUzMDk0Mzc4Ng\"",
"lastModifyingUserName": "*********",
"writersCanShare": true,
"id": "********************************",
"title": "2012 09 14 col audit report lin",
"ownerNames": [
"***** *****"
],
"sharedWithMeDate": "2013-10-23T12:21:57.688Z",
"lastViewedByMeDate": null,
"parents": [
{
"selfLink": "https://www.googleapis.com/drive/v2/files/********************************/parents/***************",
"kind": "drive#parentReference",
"id": "***************",
"isRoot": true,
"parentLink": "https://www.googleapis.com/drive/v2/files/***************"
}
],
"exportLinks": {
"application/pdf": "https://docs.google.com/feeds/download/spreadsheets/Export?key=********************************&exportFormat=pdf",
"application/x-vnd.oasis.opendocument.spreadsheet": "https://docs.google.com/feeds/download/spreadsheets/Export?key=********************************&exportFormat=ods",
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": "https://docs.google.com/feeds/download/spreadsheets/Export?key=********************************&exportFormat=xlsx"
},
"originalFilename": null,
"description": null,
"webContentLink": null,
"editable": true,
"kind": "drive#file",
"quotaBytesUsed": "0",
"fileSize": null,
"createdDate": "2012-09-14T19:41:23.142Z",
"md5Checksum": null,
"imageMediaMetadata": null,
"embedLink": "https://docs.google.com/a/mcclatchy.com/spreadsheet/ccc?key=********************************&output=html&chrome=false&widget=true",
"alternateLink": "https://docs.google.com/a/mcclatchy.com/spreadsheet/ccc?key=********************************&usp=drivesdk",
"modifiedByMeDate": null,
"downloadUrl": null,
"userPermission": {
"withLink": null,
"kind": "drive#permission",
"name": null,
"value": null,
"id": "me",
"authKey": null,
"etag": "\"KYLl3b7q6n8KW2kbVvK9NFUdVkc/0Woj6kzdwLqBirUxVylXMFf6UNc\"",
"role": "owner",
"photoLink": null,
"type": "user",
"additionalRoles": null,
"selfLink": "https://www.googleapis.com/drive/v2/files/********************************/permissions/me"
},
"fileExtension": null,
"selfLink": "https://www.googleapis.com/drive/v2/files/********************************",
"modifiedDate": "2013-10-23T12:22:23.786Z",
"iconLink": "https://ssl.gstatic.com/docs/doclist/images/icon_11_spreadsheet_list.png",
"owners": [
{
"kind": "drive#user",
"displayName": "***** *****",
"isAuthenticatedUser": true,
"permissionId": "*****************"
}
],
"lastModifyingUser": {
"kind": "drive#user",
"displayName": "*********",
"isAuthenticatedUser": false,
"permissionId": "*****************"
},
"copyable": true,
"shared": true,
"appDataContents": false
}
答案 0 :(得分:0)
确保已实施正确的重试逻辑。见handling API errors。其中一些可能是短暂的问题。
该页面还讨论了特定错误代码的可能原因。例如,401可能表示您的令牌已过期。