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 to be bound to the resource.

  • 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 Yes FinanceJoshua

The value of tag N to be bound to the resource.

  • 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://.
InstanceId String No MQ_INST_111111111111_DOxxxxxx

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-825824789DB6

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

Examples

Sample requests

http(s)://[Endpoint]/? Action=TagResources
&ResourceId.1=TopicA
&ResourceType=TOPIC
&Tag.1.Key=FinanceDept
&Tag.1.Value=FinanceJoshua
&<Common request parameters>

Sample success responses

XML format

<TagResourcesResponse>
  <RequestId>301D2CBE-66F8-403D-AEC0-825824789DB6</RequestId>
</TagResourcesResponse>

JSON format

{  
  "RequestId":"301D2CBE-66F8-403D-AEC0-825824789DB6"
}

Error codes

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