GET Bucket tagging
API Description
You can use this API to obtain tags of a specified bucket.
Method Definition
1. ObsClient->getBucketTagging(array $parameter) 2. ObsClient->getBucketTaggingAsync(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 |
||
|
Tags |
indexed array |
Bucket tag set |
||
|
Key |
string |
Tag name, which can contain up to 36 characters |
||
|
Value |
string |
Tag value, which can contain up to 43 characters |
||
Sample Code
try{
$resp = $obsClient -> getBucketTagging([
'Bucket' => 'bucketname'
]);
printf("RequestId:%s\n", $resp['RequestId']);
foreach ($resp['Tags'] as $index => $tag){
printf("TagSet[%d]\n", $index + 1);
printf("Key:%s\n", $tag['Key']);
printf("Value:%s\n", $tag['Value']);
}
}catch (Obs\Common\ObsException $obsException){
printf("ExceptionCode:%s\n", $obsException->getExceptionCode());
printf("ExceptionMessage:%s\n", $obsException->getExceptionMessage());
}
Last Article: PUT Bucket tagging
Next Article: DELETE Bucket tagging
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.