Queries the tags that have been bound to one or more resources.

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 resources whose tags you want to query. The value is an enumerated value. Valid values:

  • INSTANCE
  • TOPIC
  • GROUP
InstanceId String No MQ_INST_111111111111_DOxxxxxx

The ID of the Message Queue for Apache RocketMQ instance to which the resources belong.

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

The key of tag N that you want to query.

  • Valid values of N: 1 to 20.
  • The tag key cannot be an empty string.
  • The tag key 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 that you want to query.

  • Valid values of N: 1 to 20.
  • The tag value can be an empty string.
  • The tag 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, 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-825824789DB6

The ID of the request. This is a common parameter.

TagResources Array

An array consisting of TagResources data, such as the resource ID, resource type, and tag key-value pair.

InstanceId String MQ_INST_111111111111_DOxxxxxx

The ID of the Message Queue for Apache RocketMQ instance. This parameter is returned if you query the tags of topics or group IDs.

ResourceId String TopicA

The ID of the resource.

ResourceType String TOPIC

The type of the resource.

TagKey String CartService

The key of the returned tag.

TagValue String ServiceA

The value of the returned tag.

Examples

Sample requests

http(s)://[Endpoint]/? Action=ListTagResources
&ResourceType=TOPIC
&<Common request parameters>

Sample success responses

XML format

<ListTagResourcesResponse>
  <RequestId>301D2CBE-66F8-403D-AEC0-825824789DB6</RequestId>
  <NextToken>caeba0****be03f84eb48b699f0a4883</NextToken>
  <TagResources>
        <ResourceId>TopicA</ResourceId>
        <InstanceId>MQ_INST_111111111111_DOxxxxxx</InstanceId>
        <TagKey>CartService</TagKey>
        <ResourceType>TOPIC</ResourceType>
        <TagValue>ServiceA</TagValue>
  </TagResources>
</ListTagResourcesResponse>

JSON format

{
        "RequestId": "301D2CBE-66F8-403D-AEC0-825824789DB6",
        "NextToken": "caeba0****be03f84eb48b699f0a4883",
        "TagResources": {
            "ResourceId": "TopicA",
            "InstanceId": "MQ_INST_111111111111_DOxxxxxx",
            "TagKey": "CartService",
            "ResourceType": "TOPIC",
            "TagValue": "ServiceA"
        }
}

Error codes

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