Binds a tag to a resource.

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 to which you want to bind a tag. Valid values:

  • Instance ID
  • Topic
  • Group ID
ResourceType String Yes TOPIC

The type of the resource. The value is an enumerated value. 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 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 Yes FinanceJoshua

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

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

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.