This API is used to add or remove tags of a specific resource in batches.
TMS may use this API to manage service resource tags.
A resource can have up to 10 tags.
The API is idempotent.
If there are duplicate keys in the request body when you add tags, an error is reported.
If the key of the to-be-created tag is the same as that of an existing tag, the value of the existing tag will be overwritten.
When deleting tags, you can upload duplicate keys.
When tags are being deleted and some tags do not exist, the operation is considered successful by default, and the character set of the tags will not be checked upon deletion. A key and a value can respectively consist of up to 127 and 255 characters. The tag structure cannot be missing, and the key cannot be left blank or an empty string.
POST https://{endpoint}/v1/{project_id}/csbs_backup/{resource_id}/tags/action
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
Content-type |
Yes |
MIME type of the body in the request |
application/json |
X-Auth-Token |
Yes |
User token |
- |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID |
resource_id |
Yes |
String |
Resource ID |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
tags |
Yes |
List<resource_tag> |
Tag list This list cannot be an empty list. The list can contain up to 10 keys. Keys in this list must be unique. |
action |
Yes |
String |
Operation to be performed. The value can be set to create or delete only. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
key |
Yes |
String |
Tag key (when action is set to create) It consists of up to 36 characters. It cannot be an empty string. Spaces before and after a key will be deprecated. It can contain only letters, digits, hyphens (-), and underscores (_). Tag key (when action is set to delete) It consists of up to 127 characters. It cannot be an empty string. Spaces before and after a key will be deprecated. |
value |
Yes |
String |
Tag value (when action is set to create) This parameter is mandatory. It consists of up to 43 characters. It can be an empty string. Spaces before and after a tag value will be deprecated. It can contain only letters, digits, hyphens (-), and underscores (_). Tag value (when action is set to delete) The tag value can be passed or not. It consists of up to 255 characters. It can be an empty string. Spaces before and after a tag value will be deprecated. If the value is not passed, the tag is located and deleted based on the key and value. If the value is passed, the tag is located and deleted based on the key. |
POST https://{endpoint}/v1/{project_id}/csbs_backup/{resource_id}/tags/action
{ "action": "create", "tags": [ { "key": "key1", "value": "value1" }, { "key": "key", "value": "value3" } ] } or { "action": "delete", "tags": [ { "key": "key1", "value": "value1" }, { "key": "key2", "value": "value3" } ] }
None
Status Code |
Description |
---|---|
204 |
No Content |
Status Code |
Description |
---|---|
400 |
Invalid action. |
401 |
Authentication failed. |
403 |
You do not have permission to perform this operation. |
404 |
The requested resource was not found. |
500 |
A system exception occurs. |
For details, see Error Codes.