GET Bucket website
API Description
You can use this API to obtain the website hosting settings of a bucket.
Method Definition
1. ObsClient->getBucketWebsite(array $parameter) 2. ObsClient->getBucketWebsiteAsync(array $parameter, callable $callback)
Request Parameter
Field |
Type |
Optional or Mandatory |
Description |
---|---|---|---|
Bucket |
string |
Mandatory |
Bucket name |
Returned Result
Field |
Type |
Description |
||
---|---|---|---|---|
HttpStatusCode |
integer |
HTTP status code |
||
Reason |
string |
Reason description |
||
RequestId |
string |
Request ID returned by the OBS server |
||
RedirectAllRequestsTo |
associative array |
Redirection rule of all requests |
||
HostName |
string |
Host name used for redirection |
||
Protocol |
string |
Host name used for redirection |
||
ErrorDocument |
associative array |
Error page settings |
||
Key |
string |
Page that is returned when a 4XX error occurs |
||
IndexDocument |
associative array |
Default page settings |
||
Suffix |
string |
Suffix that is appended to a request initiated for a folder. For example, if the suffix is index.html and you request for samplebucket/images/, the returned data will be the object named images/index.html in the samplebucket bucket. The suffix can neither be null nor contain slashes (/). |
||
RoutingRules |
indexed array |
Redirection rule list |
||
Condition |
associative array |
Matching condition of a redirection rule |
||
HttpErrorCodeReturnedEquals |
integer |
HTTP error code to be matched when a redirection rule takes effect |
||
KeyPrefixEquals |
string |
Object name prefix to be matched when a redirection rule takes effect |
||
Redirect |
associative array |
Details about a redirection request |
||
Protocol |
string |
Protocol used for redirection |
||
HostName |
string |
Host name used for redirection |
||
ReplaceKeyPrefixWith |
string |
Object name prefix used in the redirection request |
||
ReplaceKeyWith |
string |
Object name used in the redirection request. This parameter cannot be used together with ReplaceKeyPrefixWith. |
||
HttpRedirectCode |
integer |
HTTP status code in the response to the redirection request |
Sample Code
try{ $resp = $obsClient -> getBucketWebsite([ 'Bucket' => 'bucketname' ]); printf("RequestId:%s\n", $resp['RequestId']); printf("ErrorDocument[Key]:%s\n", $resp['ErrorDocument']['Key']); printf("IndexDocument[Suffix]:%s\n", $resp['IndexDocument']['Suffix']); foreach ($resp['RoutingRules'] as $index => $routingRule){ printf("RoutingRules[%d]", $index + 1); printf("Condition[HttpErrorCodeReturnedEquals]:%s\n", $routingRule['Condition']['HttpErrorCodeReturnedEquals']); printf("Condition[KeyPrefixEquals]:%s\n", $routingRule['Condition']['KeyPrefixEquals']); printf("Redirect[Protocol]:%s\n", $routingRule['Redirect']['Protocol']); printf("Redirect[ReplaceKeyWith]:%s\n", $routingRule['Redirect']['ReplaceKeyWith']); printf("Redirect[HttpRedirectCode]:%s\n", $routingRule['Redirect']['HttpRedirectCode']); printf("Redirect[HostName]:%s\n", $routingRule['Redirect']['HostName']); } }catch (Obs\Common\ObsException $obsException){ printf("ExceptionCode:%s\n", $obsException->getExceptionCode()); printf("ExceptionMessage:%s\n", $obsException->getExceptionMessage()); }
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot