gpt4 book ai didi

rest - Google Drive Rest Api 文件导出限制

转载 作者:行者123 更新时间:2023-12-04 19:34:56 24 4
gpt4 key购买 nike

我使用rest api“https://www.googleapis.com/drive/v3/files/fileId/export”“reference page”来获取谷歌文档

当我尝试获取我遇到 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."
}
}

有什么办法可以解决这个错误吗?

最佳答案

您可以请求 exportLinks,而不是使用此导出端点Files: list 中的字段:

curl \
'https://www.googleapis.com/drive/v3/files/[FILE_ID]?fields=exportLinks' \
--header 'Authorization: Bearer [ACCESS_TOKEN]' \
--header 'Accept: application/json'

这将返回如下内容(这些是我为 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"
}
}

并且这些 url 没有如此严格的大小限制(我能够导出 ~50mb 的 PDF)

关于rest - Google Drive Rest Api 文件导出限制,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40890534/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com