Updated on 2025-10-29 GMT+08:00

Querying Resource Tags

Function

This API is used to query tags of a specific resource.

TMS uses this API to query all tags of a specified resource.

Calling Method

For details, see Calling APIs.

URI

GET /v1/{project_id}/{resource_type}/{resource_id}/tags

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

resource_type

Yes

String

Resource type.

resource_id

Yes

String

Resource ID.

project_id

Yes

String

Definition

Project ID, which is used to specify the project that a resource belongs to. You can query the resources of a project by project ID. You can obtain the project ID from the API or console. Obtaining the Project ID

Constraints

N/A

Range

N/A

Default Value

N/A

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

Content-type

Yes

String

Definition

Content type.

  • application/json;charset=UTF-8: common API request type

Constraints

N/A

Range

  • application/json;charset=UTF-8

Default Value

N/A

X-Auth-Token

Yes

String

User token.

You can call the IAM API to obtain a user token. The value of X-Subject-Token in the response header is the user token.

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

tags

Array of WorkspaceTag objects

Tag list.

Table 4 WorkspaceTag

Parameter

Type

Description

key

String

Tag key. It can contain a maximum of 128 Unicode characters. The tag key cannot be left blank. The system does not verify the character set of key when searching for resources. key cannot be empty, an empty string, or spaces. Before using key, delete single-byte character (SBC) spaces before and after the value.

values

Array of strings

The tag value list. Each value can contain a maximum of 255 Unicode characters. Before verification and usage, delete SBC spaces before and after the value.

The value can be an empty array but cannot be left blank.

If values is left empty, it indicates any value. All values of a tag key are in the OR relationship.

Status code: 400

Table 5 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error description.

Status code: 401

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error description.

Status code: 403

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error description.

Status code: 404

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error description.

Status code: 500

Table 9 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error description.

Example Requests

None

Example Responses

None

Status Codes

Status Code

Description

200

OK

400

Invalid parameter.

401

Authentication failed.

403

Insufficient permissions.

404

No resources found.

500

System error.

Error Codes

See Error Codes.