我正在尝试使用文档批量删除几个对象:发送批量请求。这是我的请求(<my_api_key>
是有效的API密钥以及其他方法,例如存储桶的列表内容是否正常,<my_bucket>
是确切存储桶名称的占位符):
POST /batch?key=<my_api_key>
host: www.googleapis.com
content-type:multipart/mixed; boundary="===============7330845974216740156=="
--===============7330845974216740156==
Content-Type: application/http
Content-Transfer-Encoding:binary
DELETE /storage/v1/b/<my_bucket>/o/James-Hetfield-happy.jpg
--===============7330845974216740156==
这是响应:
access-control-allow-credentials:true
access-control-allow-origin:chrome-extension://fdmmgilgnpjigdojojpjoooidkmcomcm
access-control-expose-headers:Cache-Control,Content-Encoding,Content-Length,Content-Type,Date,Expires,Pragma,Server,Vary
alternate-protocol:443:quic,p=0.02
cache-control:no-cache, no-store, max-age=0, must-revalidate
content-encoding:gzip
content-length:33
content-type:text/html; charset=UTF-8
date:Tue, 10 Feb 2015 16:55:14 GMT
expires:Fri, 01 Jan 1990 00:00:00 GMT
pragma:no-cache
server:GSE
status:500 Internal Server Error
vary:Origin
vary:X-Origin
version:HTTP/1.1
x-content-type-options:nosniff
x-frame-options:SAMEORIGIN
x-xss-protection:1; mode=block
Unknown Error
当我发送以下正文时:
--===============7330845974216740156==
DELETE /storage/v1/b/<my_bucket>/o/James-Hetfield-happy.jpg
--===============7330845974216740156==
我的身体得到200 OK响应,--batch_rTJhZwR1jHM_AAh2WtGp7ik--
但文件仍然存在。
请提供使用Google Cloud Storage JSON API发送批量删除请求的正确格式。
我的错。从示例复制粘贴时,在标头后立即出现一个备用空格字符Content-Type: application/http
。当我删除请求标头中的所有备用字符时,批量删除工作良好。
结论:复制粘贴后手动验证请求的语法。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句