You can call this operation to query the tags that are bound to a resource.

Description

You must specify at least one of the ResourceId.N, Tag.N.Key, and Tag.N.Value parameters in the request to specify the query objects.

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 resource.

ResourceType String Yes ALIYUN::GWS::INSTANCE

The type of the resource. Set the value to ALIYUN::GWS::INSTANCE.

ResourceId.N RepeatList No ecd-ia2zw38bi6cm7****

The ID of the resource, which is the ID of the cloud desktop. Valid values of N: 1 to 50.

Tag.N.Key String No TestKey

The key of tag N. Valid values of N: 1 to 20.

Tag.N.Value String No TestValue

The value of tag N. Valid values of N: 1 to 20.

MaxResults Integer No 10

The number of entries to return on each page.

NextToken String No caeba0bbb2be03f84eb48b699f0a4883

The token used to start the next query.

Response parameters

Parameter Type Example Description
NextToken String caeba0bbb2be03f84eb48b699f0a4883

The token used to start the next query.

RequestId String 484256DA-D816-44D2-9D86-B6EE4D5BA78C

The ID of the request.

TagResources Array of TagResource

The resources and their tags.

ResourceId String ecd-ia2zw38bi6cm7****

The ID of the resource, which is the ID of the cloud desktop.

ResourceType String ALIYUN::GWS::INSTANCE

The type of the resource. Valid value: ALIYUN::GWS::INSTANCE.

TagKey String TestKey

The tag key of the resource.

TagValue String TestValue

The tag value of the resource.

Examples

Sample requests

https://ecd.cn-hangzhou.aliyuncs.com/?Action=ListTagResources
&RegionId=cn-hangzhou
&ResourceType=ALIYUN::GWS::INSTANCE
&<Common Request Parameters>

Sample success responses

XML format

<ListTagResourcesResponse>
      <NextToken>caeba0bbb2be03f84eb48b699f0a4883</NextToken>
      <RequestId>484256DA-D816-44D2-9D86-B6EE4D5BA78C</RequestId>
      <TagResources>
            <ResourceId>ecd-ia2zw38bi6cm7****</ResourceId>
            <TagKey>TestKey</TagKey>
            <ResourceType>ALIYUN::GWS::INSTANCE</ResourceType>
            <TagValue>TestValue</TagValue>
      </TagResources>
</ListTagResourcesResponse>

JSON format

{
	"NextToken": "caeba0bbb2be03f84eb48b699f0a4883",
	"RequestId": "484256DA-D816-44D2-9D86-B6EE4D5BA78C",
	"TagResources": [{
		"ResourceId": "ecd-ia2zw38bi6cm7****",
		"TagKey": "TestKey",
		"ResourceType": "ALIYUN::GWS::INSTANCE",
		"TagValue": "TestValue"
	}]
}

Error codes

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