Queries the tags that are added to resource groups or the members in a resource directory.
Usage notes
This topic provides an example on how to call the API operation to query the tags
that are added to the resource group with an ID of rg-aekz6bre2uq****
. The response shows that only the k1:v1
tag is added to the resource group.
Debugging
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 | No | caeba0bbb2be03f84eb48b699f0a**** |
The token that is used to start the next query. |
MaxResults | Integer | No | 10 |
The number of entries to return on each page. Valid values: 1 to 100. Default value: 10. |
Tag.N.Key | String | No | k1 |
A tag key. |
Tag.N.Value | String | No | v1 |
A tag value. |
ResourceId.N | String | No | rg-aekz6bre2uq**** |
The ID of a resource group or member. This parameter specifies a filter condition for the query. Note If you want to query the tags that are added to the members in a resource directory,
you must configure both the
ResourceId.N and ResourceType parameters and set the ResourceType parameter to Account in your request.
|
ResourceType | String | No | ResourceGroup |
The type of the objects whose tags you want to query. This parameter specifies a filter condition for the query. Valid values:
|
For more information about common request parameters, see Common parameters.
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
NextToken | String | caeba0bbb2be03f84eb48b699f0a**** |
Indicates whether the next query is required.
|
RequestId | String | 8054B059-6B36-53BF-AA45-B8C9A0ED05AB |
The ID of the request. |
TagResources | Array of TagResource |
The tags. |
|
TagValue | String | k1 |
The tag value. |
ResourceId | String | rg-aekz6bre2uq**** |
The ID of the resource group or member. |
TagKey | String | k1 |
The tag key. |
ResourceType | String | resourcegroup |
The type of the object whose tags are queried. Valid values:
|
Examples
Sample requests
https://resourcemanager.aliyuncs.com/?Action=ListTagResources
&ResourceId.1=rg-aekz6bre2uq****
&<Common request parameters>
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<ListTagResourcesResponse>
<RequestId>8054B059-6B36-53BF-AA45-B8C9A0ED05AB</RequestId>
<TagResources>
<ResourceId>rg-aekz6bre2uq****</ResourceId>
<TagKey>k1</TagKey>
<ResourceType>resourcegroup</ResourceType>
<TagValue>v1</TagValue>
</TagResources>
</ListTagResourcesResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "8054B059-6B36-53BF-AA45-B8C9A0ED05AB",
"TagResources" : [ {
"ResourceId" : "rg-aekz6bre2uq****",
"TagKey" : "k1",
"ResourceType" : "resourcegroup",
"TagValue" : "v1"
} ]
}
Error codes
For a list of error codes, visit the API Error Center.