You can call the DescribeTags operation to query the tags of an ApsaraDB RDS instance.
Before you call this operation, make sure that the following requirements are met:
- If an instance ID is specified, all tags that are added to this instance can be queried, and the other filtering conditions are invalid.
- If you specify only TagKeys, the results that match the specified TagKey are returned. If you specify both TagKeys and TagValues, the results that match both the TagKeys and TagValues are returned.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | DescribeTags |
The operation that you want to perform. Set the value to DescribeTags. |
ClientToken | String | No | ETnLKlblzczshOTUbOCzxxxxxxxxxx |
The client token that is used to ensure the idempotence of the request. You can use the client to generate the value, but you must ensure that it is unique among different requests. The token can only contain ASCII characters and cannot exceed 64 characters in length. |
proxyId | String | No | API |
The ID of the proxy mode. |
RegionId | String | Yes | cn-hangzhou |
The ID of the region. You can call the DescribeRegions operation to query the most recent region list. |
DBInstanceId | String | No | rm-uf6wjk5xxxxxxx |
The ID of the instance. Note If you specify this parameter, the other filtering conditions are invalid.
|
Tags | String | No | {"key1":"value1"} |
The tags to be queried. Each tag includes a TagKey and a TagValue. Format: {"key1":"value1"}. |
ResourceType | String | No | INSTANCE |
The type of the resource. Set the value to INSTANCE. |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
RequestId | String | 1AD222E9-E606-4A42-BF6D-8A4442913CEF |
The ID of the request. |
Items | Array of TagInfos |
The array that consists of tag data. |
|
TagInfos | |||
TagValue | String | value1 |
The tag value. |
TagKey | String | key1 |
The tag key. |
DBInstanceIds | Array of String | rm-uf6wjk5xxxxxxx |
The IDs of instances to which the tag is added. |
Examples
Sample requests
http(s)://rds.aliyuncs.com/?Action=DescribeTags
&RegionId=cn-hangzhou
&<Common request parameters>
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<?xml version="1.0" encoding="UTF-8" ?>
<DescribeTagsResponse>
<Items>
<TagInfos>
<TagValue>1</TagValue>
<TagKey>Test</TagKey>
<DBInstanceIds>
<DBInstanceIds>rm-uf6wjk5xxxxxxx</DBInstanceIds>
</DBInstanceIds>
</TagInfos>
</Items>
<RequestId>6D709088-6D7D-4152-99F4-C2FE86463862</RequestId>
</DescribeTagsResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"Items" : {
"TagInfos" : [ {
"TagValue" : "1",
"TagKey" : "Test",
"DBInstanceIds" : {
"DBInstanceIds" : [ "rm-uf6wjk5xxxxxxx" ]
}
} ]
},
"RequestId" : "6D709088-6D7D-4152-99F4-C2FE86463862"
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
400 | Tag.NoRegionIdExist | the region Id can not be blank. | The error message returned because the RegionId parameter is empty. You must specify the RegionId parameter. |
400 | Tag.NoTagInfoExist | all the tags and tagN parameters is null. | The error message returned because the tag is invalid or incorrect. |
400 | Tag.TagKeyCanNotBeAll | tag key can not be all. | The error message returned because the tag key is invalid. |
400 | Tag.TagKeyDuplex | tag key must be sole in one operation. | The error message returned because the tag is added to the instance. Specify a different tag. |
400 | Tag.NoDBInstanceIdExist | the dbinstance Id can not be blank. | The error message returned because the DBInstanceId parameter is empty. You must specify the DBInstanceId parameter. |
400 | Tag.TooManyDBInstanceIds | the dbinstance Ids is more than 30. | The error message returned because the number of instance IDs has reached 30. |
400 | Tag.TooManyTagsForOneInstance | total 10 tags can be added to one resource. | The error message returned because the number of tags added to one resource has reached 10. You cannot add more than 10 tags to one resource. |
400 | Tag.SetTagInfoAtTwoParameters | only tags or tagN parameter could be setted. | The error message returned because the format of the Tags parameter is incorrect. |
400 | Tag.Allow5TagInfos | only 5 tags allowed in one operation. | The error message returned because more than five tags are used in a single operation. |
400 | Tag.TagKeyIsBlank | tag key can not be blank. | The error message returned because the tag key is empty. |
400 | Tag.TagKeyStartWith.aliyun | tag key and value can not be started with aliyun. | The error message returned because the tag key starts with aliyun. |
400 | Tag.TagKeyTooLong | the max tag key's length is 64. | The error message returned because tag key contains more than 64 characters. You must reduce the length of the tag key. |
400 | Tag.TagValueTooLong | the max tag value's length is 128. | The error message returned because the tag value contains more than 128 characters. You must reduce the length of the tag value. |
400 | Tag.InvalidTagsParameter | tags parameter is invalid. | The error message returned because the specified tag key and tag value are invalid. You must specify valid tag keys and tag values. |
400 | Tag.Malformed | The specified parameter Tag is not valid. | The error message returned because the specified value of the Tags parameter is invalid. You must specify a valid value for the Tags parameter. |
400 | Tag.Malformed | The specified parameter Value is not valid. | The error message returned because the specified tag value is invalid. You must specify a valid tag value. |
404 | InvalidDBInstanceId.NotFound | The DBInstanceId provided does not exist in our records. | The error message returned because the instance cannot be found. Make sure that the instance is created within your Alibaba Cloud account and is not deleted. |
For a list of error codes, visit the API Error Center.