Queries the tags of a key or a secret.
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 to which the resource belongs. Note You can call the DescribeRegions operation to query a list of available regions of the current Alibaba Cloud account. |
NextToken | String | No | caeba0bbb2be03f84eb48b699f0a4883 | The token that is returned for the next query. Note If the call does not return all result entries, the value of the NextToken parameter is returned. By default, 200 rows are returned. You can call this operation again and set the value of the parameter to the value of the parameter that is returned in the last call to implement paged query. |
ResourceType | String | Yes | key | The type of resource whose tags you want to query. Valid values:
|
ResourceId.N | String | No | key-hzz62f1cb66fa42qo**** | The IDs of the resources whose tags you want to query. You can enter up to 50 resource IDs. Enter multiple resource IDs in the |
Tag.N.Key | String | No | disk-encryption | The tag key. A tag consists of a key-value pair. You can enter up to 20 tags. Enter multiple tags in the Note The tag key cannot start with aliyun or acs:. |
Tag.N.Value | String | No | true | The tag value. A tag consists of a key-value pair. You can enter up to 20 tags. Enter multiple tags in the |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
NextToken | String | e71d8a535bd9cc11 | The token that is returned for this call. The value is used to determine whether the token is available to start the next query.
|
RequestId | String | 00827261-20B7-4562-83F2-4DF39876A45A | The request ID. |
TagResources | Array of TagResource | The tags returned. | |
TagResource | |||
ResourceType | String | key | The resource type. |
TagValue | String | true | The tag value. |
ResourceId | String | key-hzz62f1cb66fa42qo**** | The resource ID. |
TagKey | String | disk-encryption | The tag key. |
Examples
Sample requests
http(s)://[Endpoint]/?Action=ListTagResources
&RegionId=cn-hangzhou
&NextToken=caeba0bbb2be03f84eb48b699f0a4883
&ResourceType=key
&ResourceId=["key-hzz62f1cb66fa42qo****"]
&Tag=[{"Key":"disk-encryption","Value":"true"}]
&<Common request parameters>
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<ListTagResourcesResponse>
<NextToken>e71d8a535bd9cc11</NextToken>
<RequestId>00827261-20B7-4562-83F2-4DF39876A45A</RequestId>
<TagResources>
<ResourceType>key</ResourceType>
<TagValue>true</TagValue>
<ResourceId>key-hzz62f1cb66fa42qo****</ResourceId>
<TagKey>disk-encryption</TagKey>
</TagResources>
</ListTagResourcesResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"NextToken" : "e71d8a535bd9cc11",
"RequestId" : "00827261-20B7-4562-83F2-4DF39876A45A",
"TagResources" : [ {
"ResourceType" : "key",
"TagValue" : "true",
"ResourceId" : "key-hzz62f1cb66fa42qo****",
"TagKey" : "disk-encryption"
} ]
}
Error codes
Http status code | Error code | Error message | Description |
---|---|---|---|
400 | Duplicate.TagKey | The specified tagKey is duplicate. | The specified tag value is a duplicate. |
404 | InvalidAccessKeyId.NotFound | The Access Key ID provided does not exist in our records. | The specified AccessKey ID does not exist. |
404 | InvalidResourceId.NotFound | The specified ResourceId is not found. | The specified resource ID is not found. |
For a list of error codes, see Service error codes.