You can call the ListTagResources operation to query tags that are bound to one or more ApsaraDB RDS instances.
Debugging
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 ID of the region. You can call the DescribeRegions operation to query the most recent region list. |
ResourceType | String | Yes | INSTANCE |
The type of the resource. Set the value to INSTANCE. |
NextToken | String | No | 212db86sca4384811e0b5e8707ec21345 |
The token required to obtain 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 specify the token returned from the previous query to obtain more results. |
ResourceId.N | String | No | rm-uf6wjk5******* |
The ID of the instance. You can query the tags of N instances at a time. Valid values of N: 1 to 50. Note You must specify at least one of the ResourceId.N and Tag.N.Key parameters.
|
Tag.N.Key | String | No | testkey1 |
The key of the tag. You can query N tag keys at a time. Valid values of N: 1 to 20. The value of this parameter cannot be an empty string. Note You must specify at least one of the ResourceId.N and Tag.N.Key parameters.
|
Tag.N.Value | String | No | testvalue1 |
The tag value that is associated with the specified tag key. You can specify N tag values at a time. Valid values of N: 1 to 20. This parameter can be an empty string. |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
NextToken | String | 212db86sca4384811e0b5e8707ec21345 |
The token required to obtain more results. If a query does not return all results, in the next query, you can provide the token returned by the previous query to obtain more results. |
RequestId | String | 47A514A1-4B77-4E30-B4C5-2A880650B3FD |
The ID of the request. |
TagResources | Array of TagResource |
The information of the returned instances and tags. |
|
TagResource | |||
TagValue | String | testvalue1 |
The tag value that is associated with the specified tag key. |
ResourceType | String | ALIYUN::RDS::INSTANCE |
The resource type. The value |
ResourceId | String | rm-uf6wjk5xxxxxxx |
The ID of the instance. |
TagKey | String | testkey1 |
The key of the tag. |
Examples
Sample requests
http(s)://rds.aliyuncs.com/?Action=ListTagResources
&RegionId=cn-hangzhou
&ResourceType=INSTANCE
&ResourceId.1=rm-uf6wjk5xxxxxxx
&Tag.1.Key=testkey1
&<Common request parameters>
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<ListTagResourcesResponse>
<TagResources>
<TagResource>
<ResourceType>ALIYUN::RDS::INSTANCE</ResourceType>
<TagValue>testvalue1</TagValue>
<ResourceId>rm-uf6wjk5xxxxxxx</ResourceId>
<TagKey>testkey1</TagKey>
</TagResource>
</TagResources>
<RequestId>47A514A1-4B77-4E30-B4C5-2A880650B3FD</RequestId>
</ListTagResourcesResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"TagResources" : {
"TagResource" : [ {
"ResourceType" : "ALIYUN::RDS::INSTANCE",
"TagValue" : "testvalue1",
"ResourceId" : "rm-uf6wjk5xxxxxxx",
"TagKey" : "testkey1"
} ]
},
"RequestId" : "47A514A1-4B77-4E30-B4C5-2A880650B3FD"
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
400 | BothEmpty.TagsAndResources | The specified Tags and ResourcesIds are not allow to both empty. | The error message returned because the Tag.N.Key and ResourceId parameters cannot be both empty. |
400 | InvalidParameter.ResourceType | The parameter ResourceType is invalid. | The error message returned because the value of the ResourceType parameter is invalid. |
For a list of error codes, visit the API Error Center.