我想使用Postman的Google云端硬盘,当我尝试点击API时,我发现了一个错误。
网址:
https://www.googleapis.com/drive/v3/files/1Iwvqcx073GhEU9eRD4vPihXoj2AV63LEyLZwu6i0jTQ?alt=media
我得到了:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "fileNotDownloadable",
"message": "Only files with binary content can be downloaded. Use Export with Google Docs files.",
"locationType": "parameter",
"location": "alt"
}enter code here
],
"code": 403,
"message": "Only files with binary content can be downloaded. Use Export with Google Docs files."
}
}
答案 0 :(得分:1)
如果您要获取pdf文件,则需要添加responseType: 'blob'
https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Sending_and_Receiving_Binary_Data 检查此链接以获取有关如何处理文件内容下载的更多信息