An error attempting to rename a Google Bucket obje

2019-09-16 07:09发布

I try to rename an object in a bucket (below named BUCKET). I obtain an access token (XXX) and use it below. But it does not work. See the transcript:

$ curl -X POST -H "Authorization: Bearer XXX" \
"https://www.googleapis.com/upload/storage/v1/b/BUCKET/o/rdf.ads/rewriteTo/b/BUCKET/o/xxx"
{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "badContent",
    "message": "Unsupported content with type: application/octet-stream"
   }
  ],
  "code": 400,
  "message": "Unsupported content with type: application/octet-stream"
 }
}

I think it is a Google bug. Or why does it not work?!

1条回答
趁早两清
2楼-- · 2019-09-16 08:06

You need to remove the "upload" prefix in that path (see the HTTP request documented at https://cloud.google.com/storage/docs/json_api/v1/objects/rewrite)

查看更多
登录 后发表回答