All Products
Search
Document Center

Resource Management:ListTagKeys

Last Updated:Mar 03, 2024

Queries tag keys.

Operation description

This topic provides an example on how to call the API operation to query the tag keys in the cn-hangzhou region. The response shows that the following tag keys exist: team, k1, and k2.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringYes

The region ID.

For more information about region IDs, see Endpoints .

cn-hangzhou
NextTokenstringNo

The token that is used to start the next query.

caeba0bbb2be03f84eb48b699f0a****
PageSizeintegerNo

The number of tag keys to return on each page.

Maximum value: 1000. Default value: 50.

50
CategorystringNo

The type of the resource tags. This parameter specifies a filter condition for the query. Valid values:

  • all (default value)
  • custom
  • system
Note The value of this parameter is not case-sensitive.
all
ResourceTypestringNo

The resource type. This parameter specifies a filter condition for the query.

Format: ALIYUN::${ProductCode}::${ResourceType}. All letters in the value of this parameter must be in uppercase.

  • ProductCode: the service code. You can set this field to a value obtained from the response of the ListSupportResourceTypes operation.
  • ResourceType: the resource type. You can set this field to a value obtained from the response of the ListSupportResourceTypes operation.
ALIYUN::ECS::INSTANCE
QueryTypestringNo

The category of the tags. This parameter specifies a filter condition for the query. Valid values:

  • ResourceTag: resource tags, including custom and system tags. This is the default value.
  • MetaTag: preset tags.
Note The value of this parameter is not case-sensitive.
ResourceTag
FuzzyTypestringNo

The type of the query. Valid values:

  • EQUAL: exact match. This is the default value.
  • PREFIX: prefix-based fuzzy match.
Note This parameter is available only in the China (Shenzhen) and China (Hong Kong) regions.
EQUAL
TagFilter.KeystringNo

The tag key.

This parameter is used together with the FuzzyType parameter.

Note This parameter is available only in the China (Shenzhen) and China (Hong Kong) regions.
team

Response parameters

ParameterTypeDescriptionExample
object

The response parameters.

NextTokenstring

Indicates whether the next query is required. The value of this parameter may be empty.

  • If the value of this parameter is empty ("NextToken": ""), all results are returned, and the next query is not required.
  • If the value of this parameter is not empty, the next query is required, and the value is the token used to start the next query.
caeba0bbb2be03f84eb48b699f0a****
RequestIdstring

The ID of the request.

DC09A6AA-2713-4E10-A2E9-E6C5C43A8842
Keysobject []

The information of the tag keys.

Keystring

The tag key.

team
Categorystring

The type of the resource tag. Valid values:

  • custom
  • system
custom
Descriptionstring

The description of the tag key.

Business team

Examples

Sample success responses

JSONformat

{
  "NextToken": "caeba0bbb2be03f84eb48b699f0a****",
  "RequestId": "DC09A6AA-2713-4E10-A2E9-E6C5C43A8842",
  "Keys": {
    "Key": [
      {
        "Key": "team",
        "Category": "custom",
        "Description": "Business team"
      }
    ]
  }
}

Error codes

HTTP status codeError codeError messageDescription
400FuzzyQuery.NotSupportThe fuzzy query is not supported.-
403Invalid.NextTokenThe parameter NextToken is invalid.The parameter NextToken is invalid.
403NoPermission.OperatorThe user is not authorized to operate on the specified resource.The user is not authorized to operate on the specified resource.
403InvalidParameter.CategoryThe specified Category is invalid. Valid values are Custom and System.The specified Category is invalid. Valid values are Custom and System.
403InvalidParameter.ResourceTypeThe ResourceType parameter is invalid.The ResourceType parameter is invalid.

For a list of error codes, visit the Service error codes.