Attaches a tag to a resource.

Note

You can call this operation to classify resources in Message Queue for Apache RocketMQ. This facilitates 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 business requirements. For more information, see QPS limit.

Authorization information

By default, only Alibaba Cloud accounts can call this operation. RAM users can call this operation only after these RAM users are authorized. 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:*:*:*

Request parameters

Parameter Type Required Example Description
Action String Yes TagResources

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

InstanceId String No MQ_INST_188077086902****_BXSuW61e

The ID of the Message Queue for Apache RocketMQ instance to which the resource you want to attach a tag to belongs.

Note To attach a tag to a topic or a group, configure this parameter.
ResourceType String Yes TOPIC

The type of the resource to which you want to attach a tag. The value is an enumerated value. Valid values:

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

The key of the tag that is attached to the resource. If you configure this parameter, you must also configure the Tag.N.Key parameter.

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

The value of the tag that is attached to the resource. If you configure this parameter, you must also configure the Tag.N.Key parameter.

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

The ID of the resource to which you want to attach a tag.

  • If the resource is a Message Queue for Apache RocketMQ instance, set this parameter to the ID of the instance.
  • If the resource is a topic, set this parameter to the topic name.
  • If the resource is a group, set this parameter to the group ID.

Response parameters

Parameter Type Example Description
RequestId String 301D2CBE-66F8-403D-AEC0-82582478****

The ID of the request. This is a common parameter. Each request has a unique ID. This facilitates 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

HTTP/1.1 200 OK
Content-Type:application/xml

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

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

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

Error codes

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

Operations in the Message Queue for Apache RocketMQ console

You can attach tags to resources by calling the TagResources operation or performing operations in the Message Queue for Apache RocketMQ console. For more information, see Overview.