本文介绍了存储桶是请求者付款的存储桶,但未提供用户项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我正在尝试使用其JSON API通过多方请求将图像发布到Google云存储,但出现错误:
代码":400,"message":存储桶是请求者支付的存储桶,但未提供用户项目."
这是我的要求:

I am trying to POST image to google cloud storage via multipart request using their JSON API, but I am receiving an error:
"code": 400, "message": "Bucket is requester pays bucket but no user project provided."
HERE IS MY REQUEST:

POST /upload/storage/v1/b<my_bucket_here>/o?
uploadType=multipart&amp;name=testPostman HTTP/1.1
Host: www.googleapis.com
Content-Length: 2139
Authorization: Bearer ya29.<my_token_here>
Cache-Control: no-cache
Postman-Token: 6fb40df7-3a0d-fda6-a94e-63365f594c9d
Content-Type: multipart/form-data; boundary=----
WebKitFormBoundary7MA4YWxkTrZu0gW

------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data"; filename="profilephotos-
960x640.jpg"
Content-Type: image/jpeg

我尝试进入我的存储桶,并在其中指定了项目.唯一看起来很奇怪的是生命周期部件,它是None,当我单击以对其进行更改时,它将打开一个页面无法打开.太奇怪了.

I tried going to my bucket, and project IS specified there. The only thing that looks strange is Lifecycle part, which is None, and when I click to change it, it opens a page Failed to open. This is so weird.

可能是因为我不是项目的所有者,而是项目的管理员?为存储桶启用了计费.请帮忙!已经花了3天了.

Can it be because I am not the owner, but an Admin of the project?Billing is enabled for the bucket.Please help! Spent 3 days for this already.

推荐答案

Google Cloud Storage的请求者付费"功能允许存储桶的所有者支付存储对象的费用,但是存储桶的用户可以支付支付使用铲斗的费用.

The "requester pays" feature of Google Cloud Storage allows the owner of the bucket pays for the cost of storing the objects, but the users of the bucket to pay for the cost of using the bucket.

启用请求者付款后,每个请求都需要指定要为该请求计费的项目.唯一的例外情况是:

Once requester pays has been enabled, every request needs to specify which project is to be billed for that request. The only exceptions are:

  • 调用方是存储桶的所有者,或者
  • 调用方对存储桶的项目具有 resourcemanager.projects.createBillingAssignment 权限.

否则,您需要明确指定项目,其中包括URL参数 userProject = myProjectId .因此,根据您的情况,对您要调用的URL进行以下更改:

Otherwise, you'll need to explicitly specify a project to be billed by including the URL parameter userProject=myProjectId. So, in your case, make this change to the URL you're invoking:

POST/upload/storage/v1/b/o? userProject =您的项目& uploadType = multipart& name = testPostman

POST /upload/storage/v1/b/o?userProject=YOUR-PROJECT&uploadType=multipart&name=testPostman

这篇关于存储桶是请求者付款的存储桶,但未提供用户项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 16:22