To access a requester-pays bucket, users (except the bucket owner and IAM users under the same account as the bucket owner) must add the x-obs-request-payer: requester header in the request, indicating that the requester agrees to pay for the request and traffic. If this header is not included in the request, the authentication fails and error "403 Forbidden" is returned. If the response returned by the server includes the x-obs-request-charged: requester header, the requester is billed for the request. This rule is applicable to all API requests against requester-pays buckets.
1 2 3 4 5 6 7 8 9 | PUT /?requestPayment HTTP/1.1 Host: bucketname.obs.region.example.com Date: date Authorization: authorization Content-Length: length <RequestPaymentConfiguration> <Payer>Payer</Payer> </RequestPaymentConfiguration> |
This request contains no message parameters.
This request uses common headers. For details, see Table 3.
This request contains elements that specify the requester-pays configuration for the bucket. Configuration information is uploaded in the XML format. The following table lists request elements.
Element |
Description |
Mandatory |
---|---|---|
RequestPaymentConfiguration |
Root node of the requester-pays configuration. Parent: none |
Yes |
Payer |
Specifies who pays for accessing resources in the bucket. Type: string Parent: RequestPaymentConfiguration Value options:
|
Yes |
1 2 3 | HTTP/1.1 status_code Date: date Content-Length: length |
The response to the request uses common headers. For details, see Table 1.
This response contains no elements.
No special error responses are returned. For details about error responses, see Table 2.
1 2 3 4 5 6 7 8 9 10 | PUT/?requestPayment HTTP/1.1 User-Agent: curl/7.29.0 Host: examplebucket.obs.region.example.com Accept: */* Date: Tue, 03 Mar 2020 12:07:05 GMT Authorization: OBS H4IPJX0TQTHTHEBQQCEC:5DGAS7SBbMC1YTC4tNXY57Zl2Fo= <RequestPaymentConfiguration> <Payer>Requester</Payer> </RequestPaymentConfiguration> |
1 2 3 4 5 6 7 | HTTP/1.1 200 OK Server: OBS x-obs-request-id: 0000016A6C21AD79654C09D9AA45EB5D x-obs-id-2: 32AAAQAAEAABAAAQAAEAABAAAQAAEAABCSmfq4hegf1QZv8/ewfveE4B566v5DZ8 Content-Type: application/xml Date: Tue, 30 Apr 2019 02:45:07 GMT Content-Length: 0 |