Binds one or more tags to a resource.

Usage notes

You can call this operation to classify resources in Message Queue for Apache RocketMQ to facilitate resource search and aggregation.

QPS limit

This operation does not have a queries-per-second (QPS) limit on a single user. You can call this operation based on your actual 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

TagResources

mq:TagResources

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 TagResources

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

ResourceId.N RepeatList Yes TopicA

The ID of the resource that you want to tag. Valid values:

  • The ID of the instance.
  • Topic
  • Group ID
ResourceType String Yes TOPIC

The type of the resource. Valid values:

  • INSTANCE
  • TOPIC
  • GROUP
Tag.N.Key String Yes FinanceDept

The key of tag N that you want to bind 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 Yes FinanceJoshua

The value of tag N that you want to bind 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://.
InstanceId String No MQ_INST_188077086902****_BXSuW61e

The ID of the instance to which the resource belongs.

Note To bind a tag to a topic or a group ID, you must specify this parameter.

Response parameters

Parameter Type Example Description
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.

Examples

Sample requests

http(s)://ons.cn-zhangjiakou.aliyuncs.com/? Action=TagResources
&ResourceId.1=TopicA
&ResourceType=TOPIC
&Tag.1.Key=FinanceDept
&Tag.1.Value=FinanceJoshua
&InstanceId=MQ_INST_188077086902****_BXSuW61e
&<Common request parameters>

Sample success responses

XML format

<TagResourcesResponse>
  <RequestId>301D2CBE-66F8-403D-AEC0-82582478****</RequestId>
</TagResourcesResponse>

JSON format

{  
  "RequestId":"301D2CBE-66F8-403D-AEC0-82582478****"
}

Error codes

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

Operations in the console

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