- API Reference
- API Description
- Tag Management APIs
- Adding or Deleting Resource Tags in Batches
Adding or Deleting Resource Tags in Batches¶
Function¶
This API is used to add or delete tags in batches for a specified resource. A maximum of 10 tags can be added for one resource.
URI¶
POST /v1.0/{project_id}/clusters/{resource_id}/tags/action
Parameter | Mandatory | Type | Description |
---|---|---|---|
project_id | Yes | String | Project ID. For details about how to obtain the project ID, see Obtaining a Project ID. |
resource_id | Yes | String | Resource ID, for example, 7d85f602-a948-4a30-afd4-e84f47471c15. |
Request Parameters¶
Parameter | Mandatory | Type | Description |
---|---|---|---|
tags | Yes | List<ResourceTag> | Tag list. |
action | Yes | String | Identifies the operation. The value can be create or delete.
|
Parameter | Mandatory | Type | Description |
---|---|---|---|
key | Yes | String | Tag key. A tag key can contain a maximum of 36 Unicode characters, which cannot be null. The first and last characters cannot be spaces. It can contain only letters, digits, hyphens (-), and underscores (_). |
value | Yes | String | Key value. A tag value can contain a maximum of 43 Unicode characters, which can be null. The first and last characters cannot be spaces. It can contain only letters, digits, hyphens (-), and underscores (_). |
Response Parameters¶
None
Example Request¶
Sample request for adding tags in batches
POST /v1.0/89cd04f168b84af6be287f71730fdb4b/clusters/7d85f602-a948-4a30-afd4-e84f47471c15/tags/action { "action": "create", "tags": [ { "key": "Flower", "value": "rose" }, { "key": "Food", "value": "pie" } ] }
Sample request for deleting tags in batches
POST /v1.0/89cd04f168b84af6be287f71730fdb4b/clusters/7d85f602-a948-4a30-afd4-e84f47471c15/tags/action { "action": "delete", "tags": [ { "key": "Flower", "value": "rose" }, { "key": "Food", "value": "pie" } ] }
Response Message¶
None
Status Code¶
Returned Value | Description |
---|---|
204 | Tags are added or deleted in batches. |
400 | Invalid tag. |
401 | Authentication failed. |
403 | Insufficient permission. |
404 | No resources found. |
500 | Internal service error. |