You can call this operation to query the ApsaraDB for Redis instances that are bound to specified tags or query the tags that are bound to specified ApsaraDB for Redis instances.

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

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 No ListTagResources

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

RegionId String Yes cn-hangzhou

The ID of the region where the specified instance is located. You can call the DescribeRegions operation to query the latest regions.

ResourceType String Yes INSTANCE

The type of the specified resource. Set the value to INSTANCE.

ResourceId.N RepeatList No r-hp3xxxxxxxxxxxxx

The ID of the specified instance. You can specify multiple IDs.

Note You can specify multiple IDs in the following format: &ResourceId.1=r-hp1xxxxxxxxxxxxx&ResourceId.2=r-hp2xxxxxxxxxxxxx.
Tag.N.Key String No demokey

The key of tag N.

Note For more information about how to specify the tag key, see the sample request.
Tag.N.Value String No demovalue

The value of tag N.

Note For more information about how to specify the tag value, see the sample request.
NextToken String No 212db86sca4384811e0b5e8707ec21345

The token required to retrieve more results. This parameter is not required in the first query. If a query does not return all results, in the next query, you can provide the token returned by the previous query to retrieve more results.

Response parameters

Parameter Type Example Description
RequestId String 47A514A1-4B77-4E30-B4C5-2A880650B3FD

The ID of the request.

NextToken String 212db86sca4384811e0b5e8707ec21345

If a query does not return all results, in the next query, you can provide the token returned by the previous query to retrieve more results.

TagResources Array

The information of the returned instances and tags.

TagKey String demokey

The key of the tag.

TagValue String demovalue

The value of the tag.

ResourceType String ALIYUN::KVSTORE::INSTANCE

The type of the resource. The value is ALIYUN::KVSTORE::INSTANCE, indicating an ApsaraDB for Redis instance.

ResourceId String r-hp3xxxxxxxxxxxxx

The ID of the ApsaraDB for Redis instance.

Examples

Sample requests

https://r-kvstore.aliyuncs.com/
? Action=ListTagResources
&RegionId=cn-huhehaote
&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

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

JSON format

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

Error codes

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