You can call this operation to query the tags that are bound to one or more ROS resources.

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 tag. You can call the DescribeRegions operation to query the most recent region list.

ResourceType String Yes stack

The type of the resource. Valid values:

  • stack
  • template
ResourceId.N RepeatList No i-bp67acfmxazb4ph***

The ID of resource N. Valid values of N: 1 to 50.

Tag.N.Key String No FinanceDept

The key of tag N of 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 and cannot contain http:// or https://. It cannot start with acs: or aliyun.

Tag.N.Value String No FinanceJoshua

The value of tag N of 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 and cannot contain http:// or https://. It cannot start with acs: or aliyun.

NextToken String No caeba0bbb2be03f84eb48b699f0*****

The token that is used to start the next query.

Response parameters

Parameter Type Example Description
NextToken String caeba0bbb2be03f84eb48b699f0*****

The token that is returned for the next query.

RequestId String C429473A-5C66-4661-B5F8-4F900CD4330A

The ID of the request.

TagResources Array

A collection of resources and tags, including the resource ID, resource type, and tag key-value pair.

ResourceId String i-bp67acfmxazb4ph***

The ID of the resource.

ResourceType String stack

The type of the resource.

TagKey String FinanceDept

The tag key of the resource.

TagValue String FinanceJoshua

The tag value of the resource.

Examples

Sample requests

http(s)://[Endpoint]/? Action=ListTagResources
&RegionId=cn-hangzhou
&ResourceType=stack
&<Common request parameters>

Sample success responses

XML format

<RequestId>D3626DD2-7167-4945-82CF-BD2204F95A9D</RequestId>
<NextToken/>
<TagResources>
    <ResourceId>2554474c-73fd-41d2-ad86-****</ResourceId>
    <TagKey>FinanceDept</TagKey>
    <ResourceType>template</ResourceType>
    <TagValue>FinanceJoshua</TagValue>
</TagResources>
<TagResources>
    <ResourceId>c3db6777-440c-4f14-9525-****</ResourceId>
    <TagKey>FinanceDept</TagKey>
    <ResourceType>template</ResourceType>
    <TagValue>FinanceJoshua</TagValue>
</TagResources>
<TagResources>
    <ResourceId>c3db6777-440c-4f14-9525-****</ResourceId>
    <TagKey>FinanceDept_2</TagKey>
    <ResourceType>template</ResourceType>
    <TagValue>FinanceJoshua_2</TagValue>
</TagResources>

JSON format

{
    "RequestId": "D3626DD2-7167-4945-82CF-BD2204F95A9D",
    "NextToken": "",
    "TagResources": [
        {
            "ResourceId": "2554474c-73fd-41d2-ad86-****",
            "TagKey": "FinanceDept",
            "ResourceType": "template",
            "TagValue": "FinanceJoshua"
        },
        {
            "ResourceId": "c3db6777-440c-4f14-9525-****",
            "TagKey": "FinanceDept",
            "ResourceType": "template",
            "TagValue": "FinanceJoshua"
        },
        {
            "ResourceId": "c3db6777-440c-4f14-9525-****",
            "TagKey": "FinanceDept_2",
            "ResourceType": "template",
            "TagValue": "FinanceJoshua_2"
        }
    ]
}

Error codes

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

HTTP status code

Error code

Error message

Description

400

MissingParameter

One of the input parameters ResourceIds,Tags should be specified.

The error message returned because neither of the ResourceIds and Tags parameters is specified. You must specify at least one of them.

400

InvalidParameter

The specified parameter ResourceType is invalid, {reason}.

The error message returned because the specified resource type parameter is invalid. reason indicates the specific reason.

400

InvalidParameter

The specified parameter Tags is invalid, {reason}.

The error message returned because the specified Tags parameter is invalid. reason indicates the specific reason.

400

Duplicate.TagKey

The Tag.N.Key contain duplicate key.

The error message returned because the specified tag key already exists. Tag keys must be unique.