Queries tags based on resource IDs or tags. When you specify tags, you can either specify only keys of tags or specify keys and values of tags.

You must specify at least one of the following elements in the request: resource IDs and tags. Otherwise, an error is returned.

Request parameters

Parameter Type Required Example Description
Action String Yes ListTagResources

The operation that you want to perform. Set the value to ListTagResources.

RegionId String Yes cn-hangzhou

The ID of the region.

ResourceId.N RepeatList No bds-bp15e022622f****

The ID of resource N. Set the value to the cluster ID. You can query the tags of multiple resources. Specify the parameter name in the format of ResourceId.x, such as ResourceId.2 and ResourceId.3. N is a positive integer.

Tag.N.Key String No key1

The key of tag N that you want to query. You can specify multiple tag keys. N is a positive integer.

Tag.N.Value String No value1

The value of tag N. You can specify multiple tag values. N is a positive integer.

NextToken String No NextToken

The token used to query the next page. If the data size is excessively large, you can use the NextToken parameter to query the next page.

Response parameters

Parameter Type Example Description
NextToken String 1d2db86sca4384811e0b5e8707e68****

The token used to query the next page. If the value of the NextToken parameter is null, all the data entries are returned.

RequestId String 74F02441-9A8D-48F6-933F-E317AEB28DBF

The ID of the request.

TagResources Array of TagResource

The list of the resources.

TagResource
ResourceId String bds-bp15e022622f****

The ID of the resource.

ResourceType String ALIYUN::MULTIMOD::CLUSTER

The type of the resource.

TagKey String k1

The tag key.

TagValue String v2

The tag value.

Examples

Sample requests

http(s)://hbase.aliyuncs.com/? Action=ListTagResources
&RegionId=cn-hangzhou
&ResourceId=bds-bp15e022622f****
&<Common request parameters>

Sample success responses

XML format

<NextToken>1d2db86sca4384811e0b5e8707e68****</NextToken>
<RequestId>74F02441-9A8D-48F6-933F-E317AEB28DBF</RequestId>
<TagResources>
    <TagResource>
        <TagKey>k1</TagKey>
        <ResourceType>ALIYUN::MULTIMOD::CLUSTER</ResourceType>
        <TagValue>v2</TagValue>
        <ResourceId>bds-bp15e022622f****</ResourceId>
    </TagResource>
</TagResources>

JSON format

{"NextToken":"1d2db86sca4384811e0b5e8707e68****","RequestId":"74F02441-9A8D-48F6-933F-E317AEB28DBF","TagResources":{"TagResource":[{"TagKey":"k1","ResourceType":"ALIYUN::MULTIMOD::CLUSTER","TagValue":"v2","ResourceId":"bds-bp15e022622f****"}]}}

Error codes

For a list of error codes, visit the API Error Center.