All Products
Search
Document Center

Resource Management:ListTagValues

Last Updated:Dec 18, 2024

Queries the tag values of a tag key.

Operation description

This topic provides an example on how to call the API operation to query the values of the tag key k1 in the cn-hangzhou region. The response shows that the value of the tag key k1 is v1.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
tag:ListTagValuesget
*All Resources
*
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringYes

The region ID.

For more information about region IDs, see Endpoints .

cn-hangzhou
KeystringYes

The tag key. This parameter specifies a filter condition for the query.

k1
NextTokenstringNo

The token that is used to start the next query.

caeba0bbb2be03f84eb48b699f0a****
PageSizeintegerNo

The number of tag values to return on each page.

Maximum value: 1000. Default value: 50.

50
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.
EQUAL
TagFilter.ValuestringNo

The tag value.

This parameter is used together with the FuzzyType parameter.

v1

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.

8989CA7E-D2E0-4B6D-8282-311106E80150
Valuesarray

The information of the tag values.

Valuestring

The information of the tag values.

v1

Examples

Sample success responses

JSONformat

{
  "NextToken": "caeba0bbb2be03f84eb48b699f0a****",
  "RequestId": "8989CA7E-D2E0-4B6D-8282-311106E80150",
  "Values": {
    "Value": [
      "v1"
    ]
  }
}

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.
403NoPermissionKey.OperatorYou are not authorized to operate the tag key.You are not authorized to operate the tag key.
403InvalidParameter.ResourceTypeThe ResourceType parameter is invalid.The ResourceType parameter is invalid.
403InvalidParameter.TagKeyThe Tag.N.Key parameter is invalid.The Tag.N.Key parameter is invalid.
403MetaTagKeyNotFoundThe meta tag key is not found.-
404Missing.TagKeyTag.N.Value has been specified and you must specify Tag.N.Key.Tag.N.Value has been specified and you must specify Tag.N.Key.
404MissingParameter.TagKeyYou must specify TagKey.You must specify TagKey.

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

Change history

Change timeSummary of changesOperation
No change history