Abd*_*Abd 8 rest google-drive-api
我使用rest api“ https://www.googleapis.com/drive/v3/files/fileId/export ”“参考页面”来获取谷歌文档
当我尝试获取我遇到 json 错误的文件时,我的文档大小约为 5 MB:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "exportSizeLimitExceeded",
"message": "This file is too large to be exported."
}
],
"code": 403,
"message": "This file is too large to be exported."
}
}
Run Code Online (Sandbox Code Playgroud)
有什么办法可以解决这个错误吗?
您可以exportLinks
在Files: 列表中请求字段,而不是使用此导出端点:
curl \
'https://www.googleapis.com/drive/v3/files/[FILE_ID]?fields=exportLinks' \
--header 'Authorization: Bearer [ACCESS_TOKEN]' \
--header 'Accept: application/json'
Run Code Online (Sandbox Code Playgroud)
这将返回如下内容(这些是我为 Google 幻灯片演示获得的链接):
{
"exportLinks": {
"application/vnd.oasis.opendocument.presentation": "https://docs.google.com/feeds/download/presentations/Export?id=[FILE_ID]&exportFormat=odp",
"application/pdf": "https://docs.google.com/feeds/download/presentations/Export?id=[FILE_ID]&exportFormat=pdf",
"application/vnd.openxmlformats-officedocument.presentationml.presentation": "https://docs.google.com/feeds/download/presentations/Export?id=[FILE_ID]&exportFormat=pptx",
"text/plain": "https://docs.google.com/feeds/download/presentations/Export?id=[FILE_ID]&exportFormat=txt"
}
}
Run Code Online (Sandbox Code Playgroud)
并且这些 url 没有如此严格的大小限制(我能够导出 ~50mb 的 PDF)
归档时间: |
|
查看次数: |
3460 次 |
最近记录: |