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

Querying Resource Tags by Project

Function

This API is used to query tags of resources that are in a specified project.

Calling Method

For details, see Calling APIs.

URI

GET /v1/resource-manager/{resource_type}/tags

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

resource_type

Yes

String

Resource type.

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

limit

No

Integer

Number of records that can be queried. The default value is 1000. The minimum value is 1.

Minimum: 1

Maximum: 1000

Default: 1000

offset

No

Integer

Index position. If the offset element is set to N, the resource query starts from the N+1 piece of data. If action is set to filter, the value of offset is 0 by default, indicating that the query starts from the first piece of data. The offset value must be a number and cannot be a negative number.

Minimum: 0

Default: 0

Request Parameters

None

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

tags

Array of Tag objects

Tags.

total_count

Integer

The total number of records.

Table 4 Tag

Parameter

Type

Description

key

String

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

Minimum: 1

Maximum: 128

values

Array of strings

Tag values. A key can contain up to 255 Unicode characters. Before verifying or using the value element, delete single-byte character (SBC) spaces before and after the value. The value can be an empty array but cannot be left blank. If no value is specified, any values are supported. Values are in an Or relathionship. The system does not verify the character set of bvaluesb when searching for resources, but only verifies the length.

Maximum: 255

Array Length: 0 - 20

Status code: 400

Table 5 Response body parameters

Parameter

Type

Description

error_code

String

Specifies the error code.

error_msg

String

Specifies the error message.

Status code: 401

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Specifies the error code.

error_msg

String

Specifies the error message.

Status code: 403

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Specifies the error code.

error_msg

String

Specifies the error message.

Status code: 404

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Specifies the error code.

error_msg

String

Specifies the error message.

Status code: 500

Table 9 Response body parameters

Parameter

Type

Description

error_code

String

Specifies the error code.

error_msg

String

Specifies the error message.

Example Requests

Querying All Resource Tag Sets of a Tenant Instance Type

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

Example Responses

Status code: 200

Succeeded.

{
  "tags" : [ {
    "key" : "key1",
    "values" : [ "value1", "value2" ]
  }, {
    "key" : "key2",
    "values" : [ "value1", "value2" ]
  } ],
  "total_count" : 1001
}

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.