You can call this operation to query tags that are attached to one or more resources.

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.

NextToken String Yes MTRBMDc0NjAtRUJFNy00N0NBLTk3NTctMTJDQzQ

The token that is obtained from the current page to retrieve the next page of results.

RegionId String Yes cn-hangzhou

The ID of the region.

ResourceType String Yes template

The type of the resource. Valid values:

template

execution

ResourceIds Json No ["templateNam1","templateName2"]

The IDs of resources. The number of resource IDs ranges from 1 to 50.

Tags Json No {"k1":"v2","k2":"v2"}

The tag keys and values. The number of key-value pairs ranges from 1 to 20.

Response parameters

Parameter Type Example Description
NextToken String MTRBMDc0NjAtRUJFNy00N0NBLTk3NTctMTJDQzQ

The token that is required to retrieve the next page of results. To retrieve the next page of results, specify this parameter in the Request parameters section. If the return value of the NextToken parameter is empty, the next page does not exist.

RequestId String A5EF78C1-67FC-4E36-A6A8-7DF9C51726DF

The ID of the request.

TagResources Array

The set of resources and their tags.

TagResource

The tags that are attached to a resource.

ResourceId String TagTest2

The ID of the resource.

ResourceType String template

The type of the resource.

TagKey String k1

The tag key of the resource.

TagValue String v1

The tag value of the resource.

Examples

Sample requests


http(s)://[Endpoint]/? Action=ListTagResources
&NextToken=MTRBMDc0NjAtRUJFNy00N0NBLTk3NTctMTJDQzQ
&RegionId=cn-hangzhou
&ResourceType=template
&<Common request parameters>

Sample success responses

XML format

<ListTagResourcesResponse> 
  <TagResources>
        <TagResource>
              <ResourceType>template</ResourceType>
              <TagValue>v1</TagValue>
              <ResourceId>TagTest2</ResourceId>
              <TagKey>k1</TagKey>
        </TagResource>
        <TagResource>
              <ResourceType>template</ResourceType>
              <TagValue>v1</TagValue>
              <ResourceId>TagTest3</ResourceId>
              <TagKey>k1</TagKey>
        </TagResource>
        <TagResource>
              <ResourceType>template</ResourceType>
              <TagValue>v1</TagValue>
              <ResourceId>TagTest4</ResourceId>
              <TagKey>k1</TagKey>
        </TagResource>
        <TagResource>
              <ResourceType>template</ResourceType>
              <TagValue>v1</TagValue>
              <ResourceId>TagTest5</ResourceId>
              <TagKey>k1</TagKey>
        </TagResource>
  </TagResources>
  <NextToken></NextToken>
  <RequestId>A5EF78C1-67FC-4E36-A6A8-7DF9C51726DF</RequestId>
</ListTagResourcesResponse>

JSON format

{
	"TagResources":{
		"TagResource":[
			{
				"ResourceType":"template",
				"TagValue":"v1",
				"ResourceId":"TagTest2",
				"TagKey":"k1"
			},
			{
				"ResourceType":"template",
				"TagValue":"v1",
				"ResourceId":"TagTest3",
				"TagKey":"k1"
			},
			{
				"ResourceType":"template",
				"TagValue":"v1",
				"ResourceId":"TagTest4",
				"TagKey":"k1"
			},
			{
				"ResourceType":"template",
				"TagValue":"v1",
				"ResourceId":"TagTest5",
				"TagKey":"k1"
			}
		]
	},
	"NextToken":"",
	"RequestId":"A5EF78C1-67FC-4E36-A6A8-7DF9C51726DF"
}

Error codes

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