Updated on 2025-06-30 GMT+08:00

Adding a Resource Tag

Function

This API is used to add a resource tag.

API Calling

For details, see Calling APIs.

URI

POST /v3/{project_id}/{resource_type}/{resource_id}/tags

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID.

resource_type

Yes

String

Resource type. The value is cts-tracker.

resource_id

Yes

String

Resource ID.

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

tag

No

ResourceTag object

Tags. A maximum of 10 keys are allowed. Each key contains a maximum of 10 values. The structure body cannot be missing, and the key cannot be left blank or set to an empty string. Each tag key must be unique, and the tag values of a key must also be unique.

Table 3 ResourceTag

Parameter

Mandatory

Type

Description

key

No

String

Tag key, which can contain a maximum of 128 Unicode characters. A tag value can contain letters, digits, spaces, and special characters (_.:/=+-@). It cannot start or end with a space, or start with _sys_.

value

No

String

Tag value, which can contain a maximum of 255 Unicode characters. If value is specified, tags are deleted by key and value. If value is not specified, tags are deleted by key. A tag value can contain letters, digits, spaces, and special characters (_.:/=+-@) but cannot start or end with a space.

Response Parameters

Status code: 204

The request is successful.

None.

Example Request

https://{endpoint}/v3/{project_id}/{resource_type}/{resource_id}/tags

{
  "tag" : {
    "key" : "",
    "value" : ""
  }
}

Example Response

None.

Status Codes

Status Code

Description

204

The request is successful.

Error Codes

For details, see Error Codes.