Queries the relationships between ApsaraDB for Redis instances and tags.

You can also query the relationships between instances and tags in the ApsaraDB for Redis console. For more information, see Filter ApsaraDB for Redis instances by tag and View tags bound to an instance.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

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 region ID of the instance.

ResourceType String Yes INSTANCE

The resource type. Set the value to INSTANCE.

NextToken String No 212db86sca4384811e0b5e8707ec2****

The token used to start the next query to retrieve more results.

Note This parameter is not required in the first query. If not all results are returned in one query, you can pass in the NextToken value returned in the previous query to perform the query again.
ResourceId.N String No r-bp1zxszhcgatnx****

The ID of instance N. You can specify multiple IDs.

Note
  • N specifies the serial number of the instance. For example, ResourceId.1 specifies the ID of the first instance and ResourceId.2 specifies the ID of the second instance.
  • You must specify this parameter or the Tag.N.Key parameter.
Tag.N.Key String No demokey

The key of tag N.

Note
  • N specifies the serial number of the tag. For example, Tag.1.Key specifies the key of the first tag and Tag.2.Key specifies the key of the second tag.
  • You must specify this parameter or the ResourceId.N parameter.
Tag.N.Value String No demovalue

The value of tag N.

Note N specifies the serial number of the tag. For example, Tag.1.Value specifies the value of the first tag and Tag.2.Value specifies the value of the second tag.

Response parameters

Parameter Type Example Description
NextToken String 212db86sca4384811e0b5e8707ec2****

If not all results are returned in one query, you can pass in the NextToken value returned in the previous query to perform the query again.

RequestId String 47A514A1-4B77-4E30-B4C5-2A880650****

The ID of the request.

TagResources Array of TagResource

Details about the instances and tags.

TagResource
TagValue String demovalue

The value of the tag.

ResourceType String ALIYUN::KVSTORE::INSTANCE

The resource type. The return value is ALIYUN::KVSTORE::INSTANCE. This value indicates an ApsaraDB for Redis instance.

ResourceId String r-bp1zxszhcgatnx****

The resource ID, which is also the ID of the ApsaraDB for Redis instance.

TagKey String demokey

The key of the tag.

Examples

Sample requests

https://r-kvstore.aliyuncs.com/?Action=ListTagResources
&RegionId=cn-hangzhou
&ResourceType=INSTANCE
&Tag.1.Key=demokey1
&Tag.1.Value=demovalue1
&Tag.2.Key=demokey2
&Tag.2.Value=demovalue2
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<ListTagResourcesResponse>
    <TagResources>
        <TagResource>
            <ResourceType>ALIYUN::KVSTORE::INSTANCE</ResourceType>
            <TagValue>demovalue1</TagValue>
            <ResourceId>r-bp1zxszhcgatnx****</ResourceId>
            <TagKey>demokey1</TagKey>
        </TagResource>
        <TagResource>
            <ResourceType>ALIYUN::KVSTORE::INSTANCE</ResourceType>
            <TagValue>demovalue1</TagValue>
            <ResourceId>r-bp1zxszhcgatnx****</ResourceId>
            <TagKey>demokey1</TagKey>
        </TagResource>
        <TagResource>
            <ResourceType>ALIYUN::KVSTORE::INSTANCE</ResourceType>
            <TagValue>demovalue2</TagValue>
            <ResourceId>r-bp1zxszhcgatnx****</ResourceId>
            <TagKey>demokey2</TagKey>
        </TagResource>
        <TagResource>
            <ResourceType>ALIYUN::KVSTORE::INSTANCE</ResourceType>
            <TagValue>demovalue2</TagValue>
            <ResourceId>r-bp1zxszhcgatnx****</ResourceId>
            <TagKey>demokey2</TagKey>
        </TagResource>
    </TagResources>
    <RequestId>47A514A1-4B77-4E30-B4C5-2A880650****</RequestId>
</ListTagResourcesResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "TagResources" : {
    "TagResource" : [ {
      "ResourceType" : "ALIYUN::KVSTORE::INSTANCE",
      "TagValue" : "demovalue1",
      "ResourceId" : "r-bp1zxszhcgatnx****",
      "TagKey" : "demokey1"
    }, {
      "ResourceType" : "ALIYUN::KVSTORE::INSTANCE",
      "TagValue" : "demovalue1",
      "ResourceId" : "r-bp1zxszhcgatnx****",
      "TagKey" : "demokey1"
    }, {
      "ResourceType" : "ALIYUN::KVSTORE::INSTANCE",
      "TagValue" : "demovalue2",
      "ResourceId" : "r-bp1zxszhcgatnx****",
      "TagKey" : "demokey2"
    }, {
      "ResourceType" : "ALIYUN::KVSTORE::INSTANCE",
      "TagValue" : "demovalue2",
      "ResourceId" : "r-bp1zxszhcgatnx****",
      "TagKey" : "demokey2"
    } ]
  },
  "RequestId" : "47A514A1-4B77-4E30-B4C5-2A880650****"
}

Error codes

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