Queries the tags bound to a resource.

Usage notes

When you specify one of Tag.N.Key, Tag.N.Value, and ResourceId.N, you can query the other two parameters.

QPS limit

The queries-per-second (QPS) limit on this operation is 10 per user. Throttling is triggered when the number of calls to this operation per second exceeds the QPS limit. Throttling may affect your business. Therefore, call this operation based on your needs. For more information, see QPS limits.

Authorization information

By default, only Alibaba Cloud accounts can call this operation. RAM users can call this operation only after they are authorized to use it. The following table lists the authorization information of this operation. For more information, see Policies and examples.

API

Action

Resource

ListTagResources

mq:ListTagResources

acs:mq:*:*:*

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes ListTagResources

The operation that you want to perform. Set the value to ListTagResources.

ResourceType String Yes TOPIC

The type of the resource. Valid values:

  • INSTANCE
  • TOPIC
  • GROUP
InstanceId String No MQ_INST_188077086902****_BXSuW61e

The ID of the instance to which the resource bound to the tags belongs.

Note To query the tags bound to a topic or a group ID, you must specify this parameter.
Tag.N.Key String No CartService

The key of tag N bound to the resource.

  • Valid values of N: 1 to 20.
  • The parameter value cannot be an empty string.
  • It can be up to 128 characters in length and cannot start with acs: or aliyun. It cannot contain http:// or https://.
Tag.N.Value String No ServiceA

The value of tag N bound to the resource.

  • Valid values of N: 1 to 20.
  • The parameter value can be an empty string.
  • It can be up to 128 characters in length and cannot start with acs: or aliyun. It cannot contain http:// or https://.
ResourceId.N RepeatList No TopicA

The ID of the resource whose tags you want to query. Valid values: instance ID, topic ID, and group ID.

NextToken String No caeba0****be03f84eb48b699f0a4883

The token to return for querying the next page.

Response parameters

Parameter Type Example Description
NextToken String caeba0****be03f84eb48b699f0a4883

The token returned to query the next page.

RequestId String 301D2CBE-66F8-403D-AEC0-82582478****

The ID of the request, which is a common parameter. Each request has a unique ID to facilitate troubleshooting and fault locating.

TagResources Array of TagResource

The returned collection of resources and tags, including the resource ID, resource type, and key-value pairs of the tags.

InstanceId String MQ_INST_188077086902****_BXSuW61e

The ID of the instance.

ResourceId String TopicA

The ID of the resource.

ResourceType String ALIYUN::MQ::TOPIC

The type of the resource.

TagKey String CartService

The key of the tag.

TagValue String ServiceA

The value of the tag.

Examples

Sample requests

http(s)://ons.cn-hangzhou.aliyuncs.com/? Action=ListTagResources
&ResourceType=TOPIC
&ResourceId.1=TopicA
&InstanceId=MQ_INST_188077086902****_BXSuW61e
&<Common request parameters>

Sample success responses

XML format

<ListTagResourcesResponse>
  <RequestId>301D2CBE-66F8-403D-AEC0-82582478****</RequestId>
  <NextToken>caeba0****be03f84eb48b699f0a4883</NextToken>
  <TagResources>
        <ResourceId>TopicA</ResourceId>
        <InstanceId>MQ_INST_188077086902****_BXSuW61e</InstanceId>
        <TagKey>CartService</TagKey>
        <ResourceType>ALIYUN::MQ::TOPIC</ResourceType>
        <TagValue>ServiceA</TagValue>
  </TagResources>
</ListTagResourcesResponse>

JSON format

{
        "RequestId": "301D2CBE-66F8-403D-AEC0-82582478****",
        "NextToken": "caeba0****be03f84eb48b699f0a4883",
        "TagResources": {
            "ResourceId": "TopicA",
            "InstanceId": "MQ_INST_188077086902****_BXSuW61e",
            "TagKey": "CartService",
            "ResourceType": "ALIYUN::MQ::TOPIC",
            "TagValue": "ServiceA"
        }
}

Error codes

For a list of error codes, visit the API Error Center.

Operations in the console

In addition to calling the ListTagResources operation, you can query the tags bound to resources in the Message Queue for Apache RocketMQ console. For more information, see Overview.