Queries the tags that are associated with resources.
Operation description
Usage notes
You must specify at least ResourceId.N or Tag.N (Tag.N.Key and Tag.N.Value) in a request to identify the resources to query.
Tag.N is a resource tag that consists of a key-value pair. If you specify only Tag.N.Key, all tag values associated with the tag key are returned. An error is returned if you specify only Tag.N.Value.
If you specify both Tag.N and ResourceId.N, the query returns only the resources that are specified by ResourceId.N and are associated with all the specified tag key-value pairs.
If you specify multiple tag key-value pairs, the query returns only resources that are associated with all the specified key-value pairs.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
vpc:ListTagResources |
list |
Ipam
IpamPool
IpamScope
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| RegionId |
string |
Yes |
The region ID of the resource. |
cn-hangzhou |
| ResourceId |
array |
No |
The resource IDs. |
|
|
string |
No |
The resource ID. You can specify up to 50 resource IDs. Note
You must specify ResourceId.N or Tag.N (Tag.N.Key and Tag.N.Value). |
ipam-ccxbnsbhew0d6t**** |
|
| ResourceType |
string |
Yes |
The resource type. Valid values:
|
IPAM |
| Tag |
array<object> |
No |
The tags. |
|
|
object |
No |
The tags. |
||
| Key |
string |
No |
The tag key. You can specify up to 20 tag keys. The tag key cannot be an empty string. The tag key can be up to 64 characters in length. It must start with a letter or a Chinese character and can contain digits, periods (.), underscores (_), and hyphens (-). The tag key cannot start with Note
You must specify ResourceId.N or Tag.N (Tag.N.Key and Tag.N.Value). |
FinanceDept |
| Value |
string |
No |
The tag value. You can specify up to 20 tag values. The tag value can be an empty string. The tag value can be up to 128 characters in length and cannot contain Note
You must specify ResourceId.N or Tag.N (Tag.N.Key and Tag.N.Value). |
FinanceJoshua |
| NextToken |
string |
No |
The token that is used for the next query. Valid values:
|
FFmyTO70tTpLG6I3FmYAXGKPd**** |
| MaxResults |
integer |
No |
The number of entries to return on each page. Valid values: 1 to 50. Default value: 10. |
20 |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The response. |
||
| TagResources |
array<object> |
The details of the resources and their tags. |
|
|
object |
The details of the resources and their tags. |
||
| TagKey |
string |
The tag key. |
FinanceDept |
| TagValue |
string |
The tag value. |
FinanceJoshua |
| ResourceId |
string |
The resource ID. |
ipam-uq5dcfc2eqhpf4**** |
| ResourceType |
string |
The resource type. Valid values:
|
IPAM |
| NextToken |
string |
The token that is used for the next query. Valid values:
|
FFmyTO70tTpLG6I3FmYAXGKPd**** |
| RequestId |
string |
The request ID. |
672053AB-90C9-5693-AB96-458F137A5ED6 |
Examples
Success response
JSON format
{
"TagResources": [
{
"TagKey": "FinanceDept",
"TagValue": "FinanceJoshua",
"ResourceId": "ipam-uq5dcfc2eqhpf4****",
"ResourceType": "IPAM"
}
],
"NextToken": "FFmyTO70tTpLG6I3FmYAXGKPd****",
"RequestId": "672053AB-90C9-5693-AB96-458F137A5ED6"
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | IllegalParamSize.ResourceIds | The number of Param ResourceIds exceeded the limit. | The number of ResourceIds parameters passed in exceeds the limit. |
| 400 | IllegalParamSize.Tags | The number of Parameter Tags exceeded the limit. | The number of ResourceIds parameters passed in exceeds the limit. |
| 400 | MissingParameter.ResourceIds | The input parameter ResourceIds that is mandatory for processing this request is not supplied. | Parameter ResourceIds not passed in. |
| 400 | MissingParameter.ResourceType | The input parameter ResourceType that is mandatory for processing this request is not supplied. | Parameter ResourceType not passed in. |
| 400 | MissingParameter.TagsAndResourceIds | The input parameter Tags and ResourceIds that is mandatory for processing this request is not supplied. | The Tags and ResourceIds parameters are not passed in. |
| 400 | MissingParameter.Tags | The input parameter Tags that is mandatory for processing this request is not supplied. | Parameter ResourceType not passed in. |
| 400 | DuplicatedParam.TagKey | TagKey duplicate. | TagKey parameter duplicate |
| 400 | IllegalParam.TagKey | The input parameter TagKey is invalid. | Illegal parameter TagKey. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.