Help Center> Config> API Reference> APIs> Resource Tags> Querying Resource Tags
Updated on 2024-05-14 GMT+08:00

Querying Resource Tags

Function

This API is used to query resource tags.

Calling Method

For details, see Calling APIs.

URI

GET /v1/resource-manager/{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.

Request Parameters

None

Response Parameters

Status code: 200

Table 2 Response body parameters

Parameter

Type

Description

tags

Array of ResourceTag objects

Tags.

Table 3 ResourceTag

Parameter

Type

Description

key

String

Tag key. A tag key can contain up to 128 Unicode characters and must complay with the character set specifications in section 3.1.

Minimum: 1

Maximum: 128

value

String

Tag value. A tag value can contain up to 255 Unicode characters and must comply with the character set specifications in section 3.2.

Minimum: 0

Maximum: 255

Status code: 400

Table 4 Response body parameters

Parameter

Type

Description

error_code

String

Specifies the error code.

error_msg

String

Specifies the error message.

Status code: 401

Table 5 Response body parameters

Parameter

Type

Description

error_code

String

Specifies the error code.

error_msg

String

Specifies the error message.

Status code: 403

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Specifies the error code.

error_msg

String

Specifies the error message.

Status code: 404

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Specifies the error code.

error_msg

String

Specifies the error message.

Status code: 500

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Specifies the error code.

error_msg

String

Specifies the error message.

Example Requests

Querying Tags of a Specified Instance

GET https://{endpoint}/v1/resource-manager/{resource_type}/{resource_id}/tags

Example Responses

Status code: 200

Succeeded.

{
  "tags" : [ {
    "key" : "key1",
    "value" : "value1"
  }, {
    "key" : "key2",
    "value" : "value2"
  } ]
}

Status Codes

Status Code

Description

200

Succeeded.

400

Invalid parameter.

401

Unauthorized.

403

Forbidden.

404

Resources not found.

500

Internal server error.

Error Codes

See Error Codes.