【问题标题】:Google Cloud Storage JSON API: batch delete returns Unknown Error (500 Internal Server Error)Google Cloud Storage JSON API:批量删除返回未知错误(500 内部服务器错误)
【发布时间】:2015-02-10 17:10:00
【问题描述】:

我正在尝试使用文档批量删除多个对象:Sending Batch Requests。这是我的请求(<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==

我收到了正文 --batch_rTJhZwR1jHM_AAh2WtGp7ik-- 的 200 OK 响应,但文件仍然存在。

请告知使用 Google Cloud Storage JSON API 发送批量删除请求的正确格式。

【问题讨论】:

    标签: google-app-engine google-cloud-storage


    【解决方案1】:

    我的错。从示例中复制粘贴时,在标题 Content-Type: application/http 之后会出现一个备用空格字符。当我删除请求标头中的所有备用字符时,批量删除效果很好。

    结论:复制粘贴后手动验证请求的语法。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-02-17
      • 1970-01-01
      相关资源
      最近更新 更多