2015-02-10 86 views
3

我想批量刪除幾個對象使用文檔:Sending Batch Requests。這裏是我的要求(<my_api_key>是有效的API密鑰和其他方法,如水桶工作良好的列表內容,<my_bucket>爲確切鬥名佔位符):谷歌雲存儲JSON API:批量刪除返回未知錯誤(500內部服務器錯誤)

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== 

我用身體--batch_rTJhZwR1jHM_AAh2WtGp7ik--但文件仍然存在200 OK響應。

請使用Google Cloud Storage JSON API發送批量刪除請求的正確格式。

回答

2

我的不好。從示例中複製粘貼時,標題Content-Type: application/http後面出現一個備用空格字符。當我刪除請求標題中的所有備用字符時,批量刪除運行良好。

結論:在複製粘貼後手動驗證請求的語法。

相關問題