Queries the tags bound to a resource.

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

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. The value is an enumerated value. Valid values:

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

The ID of the Message Queue for Apache RocketMQ instance to which the resource bound to the tags belongs.

Note To query the tags bound to a topic or 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 value cannot be an empty string.
  • The value can be up to 128 characters in length. It cannot start with aliyun or acs: and 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 value can be an empty string.
  • The value can be up to 128 characters in length. It cannot start with aliyun or acs: and 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 used to query the next page.

Response parameters

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

The token used to query the next page.

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

The ID of the request.

TagResources Array of TagResource

An array consisting of a resource and tags bound to the resource, such as the resource ID, resource type, tag keys, and tag values.

InstanceId String MQ_INST_188077086902****_BXSuW61e

The ID of the Message Queue for Apache RocketMQ 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.