Set Bucket Requester Pays

By default, buckets do not have Requester Pays enabled. To enable or disable requester pays for an existing bucket you make a PUT request that is scoped to the bucket and you use the billing query string parameter. You must include an XML document in the request body that indicates whether you want to enable or disable the feature. You cannot set Requester Pays on a new bucket that you are creating.

You must have storage.buckets.update permission to enable or disable Requester Pays for an existing bucket.

Query string parameters

Parameter Description Required
billing Used when enabling or disabling Requester Pays for a bucket. If used in a PUT Bucket request, the request body should specify the enabled or disabled status. No

Request headers

See common request headers.

Request body elements

The following request body elements are applicable only if you use the billing query string parameter to enable or disable Requester Pays for an existing bucket.

Element Description
BillingConfiguration The container for RequesterPays.
RequesterPays The status to apply to the Requester Pays feature. Accepted values are Enabled and Disabled.

Request syntax

PUT /?billing HTTP/1.1
Host: <bucket>.storage.googleapis.com
Date: <date>
Content-Length: <request_body_length>
Authorization: <authentication_string>

<?xml version="1.0" encoding="UTF-8"?>
<BillingConfiguration>
  <RequesterPays>
     <Enabled/Disabled>
  </RequesterPays>
</BillingConfiguration>

Response headers

The request can return a variety of response headers depending on the request headers you use.

Response body elements

The response does not include an XML document in the response body.

Example

The following sample enables Requester Pays for a bucket named my-bucket.

Request

PUT /?billing HTTP/1.1
Host: my-bucket.storage.googleapis.com
Date: Thu, 12 Mar 2012 03:38:42 GMT
Content-Length: 121
Authorization: Bearer ya29.AHES6ZRVmB7fkLtd1XTmq6mo0S1wqZZi3-Lh_s-6Uw7p8vtgSwg

<?xml version="1.0" encoding="UTF-8"?>
<BillingConfiguration>
  <RequesterPays>Enabled</RequesterPays>
</BillingConfiguration>

Response

HTTP/1.1 200 OK
Date: Thu, 12 Mar 2012 03:38:42 GMT
Expires: Mon, 01 Jan 1990 00:00:00 GMT
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 0
Content-Type: text/html
¿Te sirvió esta página? Envíanos tu opinión:

Enviar comentarios sobre…

Cloud Storage Documentation