You can call ListTagResources to query tags that are attached to 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 headers

This operation uses the common request header only. For more information, see Common parameters.

Request syntax

GET /tags HTTPS|HTTP

Request parameters

Parameter Type Required Example Description
resource_type String Yes CLUSTER

The type of the resource.

next_token String No 1d2db86sca4384811e0b5e8707e******

The token of the first page to query.

resource_ids String No ["xxxxx","xxxxxx"]

The IDs of the resources to query.

tags String No [{"key":"env","value","dev"},{"key":"dev", "value":"IT"}]

The list of tags to query. This list is a JSON string that contains up to 20 key-value pairs.

Description

  • You must specify resource_ids or tags. Otherwise, an error message appears.
  • Only information of visible tags are returned.

Response parameters

Parameter Type Example Description
request_id String F99407AB-2FA9-489E-A259-40CF6D******

The ID of the request.

tag_resources Struct

A list of resources that have tags.

tag_resource Array

The details of a resource.

resource_id String xxxxx

The ID of the resource.

resource_type String ALIYUN::CS::CLUSTER

The type of the resource.

tag_key String env

The key of the returned tag.

tag_value String dev

The value of the returned tag.

Examples

Sample requests

GET /tags HTTP/1.1
Common request header
{
"resource_type": "CLUSTER",
"resource_ids":["xxx","yyy"],
"tags":[{"key":"env","value":"dev"},{"key":"dep","value":"IT"}]
}

Request body

GET /tags? resource_ids=["xxx","yyy"]&resource_type=CLUSTER&tags=[{"key":"env","value":"dev"},{"key":"dep","value":"IT"}]

Sample success responses

XML format

<request_id>3D8795D9-8FF5-46B2-86E6-E3B4073169BE</request_id>
<tag_resources>
    <tag_resource>
        <resource_type>ALIYUN::CS::CLUSTER</resource_type>
        <resource_id>xxxx****</resource_id>
        <tag_key>env</tag_key>
        <tag_value>dev</tag_value>
    </tag_resource>
</tag_resources>

JSON format

{
    "request_id": "3D8795D9-8FF5-46B2-86E6-E3B4073169BE",
    "tag_resources": {
        "tag_resource": [
            {
                "resource_type": "ALIYUN::CS::CLUSTER",
                "resource_id": "xxxx****",
                "tag_key": "env",
                "tag_value": "dev"
            }
        ]
    }
}

Error codes

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