Adding a Resource Tag
Function
This API is used to add tags for a resource.
A resource can have a maximum of 20 tags.
This API is an idempotent API. If the tag to be created already exists (with the same key), the existing tag will be overwritten.
URI
POST /v2/{project_id}/{resource_type}/{resource_id}/tags
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Project ID. For details about how to obtain a project ID, see Obtaining a Project ID. |
| resource_type | Yes | String | Resource type.
|
| resource_id | Yes | String | Resource ID. |
Request
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| tag | Yes | tag object | Whether tags are contained. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| key | Yes | String | Tag key, which can contain a maximum of 36 Unicode characters. The key cannot be left blank and can contain only uppercase letters, lowercase letters, digits, hyphens (-), and underscores (_). |
| value | Yes | String | Tag value. Each value can contain a maximum of 43 Unicode characters. The value cannot be left blank and can contain only uppercase letters, lowercase letters, digits, hyphens (-), and underscores (_). |
Request example:
{
"tag": {
"key": "key0",
"value": "ief-tag-test"
}
} Error Codes
For details, see Error Codes.
Last Article: Adding or Deleting Resource Tags in Batches
Next Article: Deleting a Resource Tag
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.