You can call this operation to query the tags bound 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 ListTagResources

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

RegionId String Yes cn-hangzhou

The region ID of the resource.

ResourceType String Yes instance

The type of the resource. The value is an enumerated value. Valid values:

  • Instance
  • Topic
  • Consumergroup
ResourceId.N RepeatList No alikafka_post-cn-v0h1fgs2****

The ID of resource N to which the tag will be bound.

Note: Resources that can be bound with a tag include instances, topics, and consumer groups.

Tag.N.Key String No FinanceDept

The key of tag N to be bound to the resource. Valid values of N:

  • 1 to 20
  • This parameter cannot be an empty string.
  • It 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 FinanceJoshua

The value of tag N to be bound to the resource. Valid values of N:

  • 1 to 20
  • This parameter can be an empty string.
  • It can be up to 128 characters in length. It cannot start with aliyun or acs: and cannot contain http:// or https://.
NextToken String No caeba0bbb2be03f84eb48b699f0a4883

The token for starting the next query.

Response parameters

Parameter Type Example Description
NextToken String caeba0bbb2be03f84eb48b699f0a4883

The token that is returned for the next query.

RequestId String DE65F6B7-7566-4802-9007-96F2494AC5XX

The ID of the request.

TagResources Array

The returned collection of resources and tags, including the information such as the resource ID, resource type, and tag key-value pair.

TagResource
ResourceId String alikafka_post-cn-v0h1fgs2****

The ID of the resource.

ResourceType String instance

The type of the resource.

TagKey String FinanceDept

The key of the tag bound to the resource.

TagValue String FinanceJoshua

The value of the tag bound to the resource.

Examples

Sample requests

http(s)://[Endpoint]/? Action=ListTagResources
&RegionId=cn-hangzhou
&ResourceType=instance
&ResourceId.1=alikafka_post-cn-v0h1fgs2****
&<Common request parameters>

Sample success responses

XML format

<TagResources>
    <TagResource>
        <ResourceType>instance</ResourceType>
        <TagValue>FinanceJoshua</TagValue>
        <ResourceId>alikafka_post-cn-v0h1fgs2****</ResourceId>
        <TagKey>FinanceDept</TagKey>
    </TagResource>
</TagResources>
<RequestId>DE65F6B7-7566-4802-9007-96F2494AC512</RequestId>

JSON format

{
    "TagResources":{
        "TagResource":[
            {
                "ResourceType":"instance",
                "TagValue":"FinanceJoshua",
                "ResourceId":"alikafka_post-cn-v0h1fgs2****",
                "TagKey":"FinanceDept"
            }
        ]
    },
    "RequestId":"DE65F6B7-7566-4802-9007-96F2494AC512"
}

Error codes

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