• Object Storage Service

obs
  1. Help Center
  2. Object Storage Service
  3. API Reference (PHP SDK)
  4. Bucket-Related APIs
  5. GET Bucket tagging

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

TagSet

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['TagSet'] 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());
}