ListTagResources

Updated at: 2025-04-21 02:55

Queries resources by tag.

Operation description

  • Set ResourceId.N or Tag.N that consists of Tag.N.Key and Tag.N.Value in the request to specify the object to be queried.
  • Tag.N is a resource tag that consists of a key-value pair. If you set only Tag.N.Key, all tag values that are assigned to the specified key are returned. If you set only Tag.N.Value, an error message is returned.
  • If you set both Tag.N and ResourceId.N to filter tags, ResourceId.N must match all specified key-value pairs.
  • If you specify multiple key-value pairs, resources that contain these key-value pairs are returned.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • For mandatory resource types, indicate with a prefix of * .
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
OperationAccess levelResource typeCondition keyAssociated operation
alidns:ListTagResourcesget
*All Resources
*
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
ParameterTypeRequiredDescriptionExample
LangstringNo

The language of the content within the request and response. Default value: zh. Valid values:

  • zh: Chinese
  • en: English
en
ResourceTypestringYes

The type of the resource. Valid values:

  • DOMAIN: domain name
DOMAIN
NextTokenstringNo

The pagination token. It can be used in the next request to retrieve a new page of results.

4698691
Tagarray<object>No

The tags.

objectNo
KeystringNo

The tag key.

abcd
ValuestringNo

The key value.

abcd
ResourceIdarrayNo

The ID of the resource.

stringNo

The domain name. ResourceId is required when the key-value pair of a tag is empty.

dns-example.com

Response parameters

ParameterTypeDescriptionExample
ParameterTypeDescriptionExample
object
NextTokenstring

A pagination token. It can be used in the next request to retrieve a new page of results. If NextToken is empty, no next page exists.

4698691
RequestIdstring

The request ID.

61092C8D-6AEB-4310-B74D-C632F89BF4FB
TagResourcesarray<object>

An array that consists of the resource and the tags that are added to the resource, including information such as the resource ID, resource type, tag keys, and tag values.

TagResourceobject
ResourceTypestring

The type of the resource. Only DOMAIN is returned.

DOMAIN
TagValuestring

The tag value.

abcd
ResourceIdstring

The ID of the resource.

dns-example.com
TagKeystring

The tag key.

abcd

Examples

Sample success responses

JSONformat

{
  "NextToken": "4698691",
  "RequestId": "61092C8D-6AEB-4310-B74D-C632F89BF4FB",
  "TagResources": [
    {
      "ResourceType": "DOMAIN",
      "TagValue": "abcd",
      "ResourceId": "dns-example.com",
      "TagKey": "abcd"
    }
  ]
}

Error codes

For a list of error codes, visit the Service error codes.

  • On this page (1)
  • Operation description
  • Debugging
  • Authorization information
  • Request parameters
  • Response parameters
  • Examples
  • Error codes
Feedback