请求更新Google Drive批量请求文档:多余空行致API调用失败
Google Drive批量API格式问题反馈
自2023年7月(约两周前)起,我们产品的Google Drive批量API调用失效,持续返回HTTP 400(错误请求),提示无法解析HTTP头。
经排查,问题源于请求payload中的多余空行:
可正常运行的格式
--END_OF_PART POST https://www.googleapis.com/drive/v3/files/fileId/permissions?fields=id --END_OF_PART
文档中失效的格式(含2个空行)
--END_OF_PART POST https://www.googleapis.com/drive/v3/files/fileId/permissions?fields=id --END_OF_PART
Curl请求示例对比
可正常执行的Curl请求
curl --location 'https://www.googleapis.com/batch/drive/v3' \ --header 'Content-Type: multipart/mixed; boundary=END_OF_PART' \ --header 'Authorization: Bearer <token>' \ --data '--END_OF_PART GET https://www.googleapis.com/drive/v3/files/<fileid>/permissions --END_OF_PART-- '
无法执行的Curl请求(含多余空行)
curl --location 'https://www.googleapis.com/batch/drive/v3' \ --header 'Content-Type: multipart/mixed; boundary=END_OF_PART' \ --header 'Authorization: Bearer <token>' \ --data '--END_OF_PART GET https://www.googleapis.com/drive/v3/files/<fileid>/permissions --END_OF_PART-- '
原官方文档中的批量请求示例包含多余空行,导致调用失败。我们花费数天排查才定位问题,恳请更新文档以反映当前的格式要求。
内容的提问来源于stack exchange,提问作者KaySubb
相关产品推荐
相关产品推荐

