PUT Bucket tagging
API Description
You can use this API to set bucket tags.
Method Definition
ObsClient.setBucketTagging
Request Parameter
| Field | Type | Optional or Mandatory | Description | ||
|---|---|---|---|---|---|
| Bucket | String | Mandatory | Bucket name | ||
| Tags | Array | Mandatory | Bucket tag set | ||
| Key | String | Mandatory | Tag name, which contains 1 to 36 characters and cannot include non-printable ASCII characters (0–31) and the following special characters: *<>\= The tag keys in one bucket must be unique. | ||
| Value | String | Mandatory | Tag value, which can contain up to 43 characters and cannot include non-printable ASCII characters (0–31) and the following special characters: *<>\= | ||
Returned Result (InterfaceResult)
| Field | Type | Description |
|---|---|---|
| RequestId | String | Request ID returned by the OBS server |
Sample Code
obsClient.setBucketTagging({
Bucket : 'bucketname',
Tags : [{Key:'tag1', Value : 'value1'}, {Key:'tag2', Value : 'value2'}]
},(err, result) => {
if(err){
console.error('Error-->' + err);
}else{
if(result.CommonMsg.Status < 300){
console.log('RequestId-->' + result.InterfaceResult.RequestId);
}else{
console.log('Code-->' + result.CommonMsg.Code);
console.log('Message-->' + result.CommonMsg.Message);
}
}
}); Last Article: GET Bucket notification
Next Article: GET Bucket tagging
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.