Description
The GET Bucket website request is used to query the static website configuration associated with a bucket.
You are advised to debug this API through Platform Management > Cloud API Management > API Explorer in the console on the operation side.
Note:
API Explorer provides capabilities such as online calling, signature verification, SDK code generation, and quick interface search. You can view the request content and return results of each call and automatically generate SDK call examples.
Request
Request Example
GET /?website HTTP/1.1
Host: <BucketName-APPID>.<Endpoint>
Date: GMT Date
Authorization: Auth String
Note:
<BucketName-APPID>is the bucket name with APPID as the suffix, for example, examplebucket-1250000000.- Authorization: Auth String (For details, refer to Request Signature).
Request Parameters
This API has no request parameters.
Request Header
This API only uses common request headers. For details, see Common Request Headers documentation.
Request Body
This API has no request body.
Response
Response Headers
This API only returns the public response header. For details, see Common Response Headers documentation.
Response Body
Upon successful query, it returns application/xml data, containing the complete bucket static website configuration information.
<WebsiteConfiguration>
<IndexDocument>
<Suffix>string</Suffix>
</IndexDocument>
<RedirectAllRequestsTo>
<Protocol>string</Protocol>
</RedirectAllRequestsTo>
<ErrorDocument>
<Key>string</Key>
</ErrorDocument>
<RoutingRules>
<RoutingRule>
<Condition>
<HttpErrorCodeReturnedEquals>integer</HttpErrorCodeReturnedEquals>
</Condition>
<Redirect>
<Protocol>string</Protocol>
<ReplaceKeyWith>string</ReplaceKeyWith>
</Redirect>
</RoutingRule>
<RoutingRule>
<Condition>
<KeyPrefixEquals>string</KeyPrefixEquals>
</Condition>
<Redirect>
<Protocol>string</Protocol>
<ReplaceKeyPrefixWith>string</ReplaceKeyPrefixWith>
</Redirect>
</RoutingRule>
</RoutingRules>
</WebsiteConfiguration>
Specific node descriptions are as follows:
| Node Name (Keyword) | Parent Node | Description | Type |
|---|---|---|---|
| WebsiteConfiguration | No | Save all information from the GET Bucket website result. | Container |
Container node WebsiteConfiguration contents:
| Node Name (Keyword) | Parent Node | Description | Type |
|---|---|---|---|
| IndexDocument | WebsiteConfiguration | Index document configuration | Container |
| RedirectAllRequestsTo | WebsiteConfiguration | Redirect all request configuration | Container |
| ErrorDocument | WebsiteConfiguration | Error document configuration | Container |
| RoutingRules | WebsiteConfiguration | Redirect rule configuration. | Container |
Container node IndexDocument contents:
| Node Name (Keyword) | Parent Node | Description | Type |
|---|---|---|---|
| Suffix | WebsiteConfiguration.IndexDocument | Specify the object key suffix for the index document. For example, specifying index.html means that when accessing the root directory of the bucket, the content of index.html will be automatically returned, or when accessing the article/ directory, the content of article/index.html will be automatically returned. |
string |
Container node RedirectAllRequestsTo contents:
| Node Name (Keyword) | Parent Node | Description | Type |
|---|---|---|---|
| Protocol | WebsiteConfiguration.RedirectAllRequestsTo | Specify the target protocol for redirecting all requests. | string |
Container node ErrorDocument contents:
| Node Name (Keyword) | Parent Node | Description | Type |
|---|---|---|---|
| Key | WebsiteConfiguration.ErrorDocument | Specify the object key for the common error document. | string |
Container node RoutingRules contents:
| Node Name (Keyword) | Parent Node | Description | Type |
|---|---|---|---|
| RoutingRule | WebsiteConfiguration.RoutingRules | Single redirect rule configuration | Container |
Container node RoutingRules.RoutingRule contents:
| Node Name (Keyword) | Parent Node | Description | Type |
|---|---|---|---|
| Condition | WebsiteConfiguration.RoutingRules.RoutingRule | Condition configuration for redirect rule | Container |
| Redirect | WebsiteConfiguration.RoutingRules.RoutingRule | Specific redirect target configuration for redirect rule | Container |
Container node RoutingRules.RoutingRule.Condition contents:
| Node Name (Keyword) | Parent Node | Description | Type |
|---|---|---|---|
| HttpErrorCodeReturnedEquals | WebsiteConfiguration.RoutingRules. RoutingRule.Condition |
Specify the error code matching condition for the redirect rule. | integer |
| KeyPrefixEquals | WebsiteConfiguration.RoutingRules. RoutingRule.Condition |
Specify the object key prefix matching condition for the redirect rule. | string |
Container node RoutingRules.RoutingRule.Redirect contents:
| Node Name (Keyword) | Parent Node | Description | Type |
|---|---|---|---|
| Protocol | WebsiteConfiguration.RoutingRules. RoutingRule.Redirect |
Specify the target protocol for the redirect rule. | string |
| ReplaceKeyWith | WebsiteConfiguration.RoutingRules. RoutingRule.Redirect |
Specify the object key for the specific redirect target of the redirect rule, replacing the entire original request object key. | string |
| ReplaceKeyPrefixWith | WebsiteConfiguration.RoutingRules. RoutingRule.Redirect |
Specify the object key for the specific redirect target of the redirect rule, replacing the matched prefix portion of the original request. | string |
Error Code
This API follows unified error response and error codes. For details, please refer to the Error Codes document.
Practical Case
Request
GET /?website HTTP/1.1
Host: <BucketName-APPID>.<Endpoint>
Date: Wed, 20 May 2020 09:33:49 GMT
Authorization: q-sign-algorithm=sha1&q-ak=AKID8A0fBVtYFrNm02oY1g1JQQF0c3JO****&q-sign-time=1589967229;1589974429&q-key-time=1589967229;1589974429&q-header-list=date;host&q-url-param-list=website&q-signature=50a22a30b02b59e5da4a0820d15a36805ea7****
Connection: close
Response
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: 1163
Connection: close
Date: Wed, 20 May 2020 09:33:49 GMT
x-cos-request-id: NWVjNGY5N2RfYTdjMjJhMDlfNjZkY18yYWUx****
<WebsiteConfiguration>
<IndexDocument>
<Suffix>index.html</Suffix>
</IndexDocument>
<RedirectAllRequestsTo>
<Protocol>https</Protocol>
</RedirectAllRequestsTo>
<ErrorDocument>
<Key>pages/error.html</Key>
</ErrorDocument>
<RoutingRules>
<RoutingRule>
<Condition>
<HttpErrorCodeReturnedEquals>403</HttpErrorCodeReturnedEquals>
</Condition>
<Redirect>
<Protocol>https</Protocol>
<ReplaceKeyWith>pages/403.html</ReplaceKeyWith>
</Redirect>
</RoutingRule>
<RoutingRule>
<Condition>
<HttpErrorCodeReturnedEquals>404</HttpErrorCodeReturnedEquals>
</Condition>
<Redirect>
<ReplaceKeyWith>pages/404.html</ReplaceKeyWith>
</Redirect>
</RoutingRule>
<RoutingRule>
<Condition>
<KeyPrefixEquals>assets/</KeyPrefixEquals>
</Condition>
<Redirect>
<ReplaceKeyWith>index.html</ReplaceKeyWith>
</Redirect>
</RoutingRule>
<RoutingRule>
<Condition>
<KeyPrefixEquals>article/</KeyPrefixEquals>
</Condition>
<Redirect>
<Protocol>https</Protocol>
<ReplaceKeyPrefixWith>archived/</ReplaceKeyPrefixWith>
</Redirect>
</RoutingRule>
</RoutingRules>
</WebsiteConfiguration>