Queries the mapping relationships between applications and tags.

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 only common request headers. For more information, see Common request parameters and common response parameters.

Request syntax

GET /tags HTTP/1.1

Request parameters

Parameter Type Position Required Example Description
RegionId String Query Yes cn-beijing

The ID of the region.

ResourceType String Query Yes application

The type of the resource. Set the value to application.

NextToken String Query No A2RN

A maximum of 50 entries can be returned for a query. If a query generates more than 50 entries, the NextToken parameter is returned with the first 50 entries. You can use the NextToken parameter value to retrieve the subsequent entries that are not returned in the current query result.

ResourceIds String Query No ["d42921c4-5433-4abd-8075-0e536f8b****"]

The resource ID. Separate multiple resource IDs with comma (,). This parameter is required if you do not specify the Tags parameter.

Tags String Query No [{"key":"k1","value":"v1"}]

The tag in the format of a key-value pair. This parameter is required if you do not specify the ResourceIds parameter.

  • key: the tag key. It cannot exceed 128 characters in length.
  • value: the tag value. It cannot exceed 128 characters in length.

Tag keys and tag values are case-sensitive. If you specify multiple tags, the system adds all the tags to the specified resources. Each tag key on a resource can have only one tag value. If you attempt to add a tag that has the same key as an existing tag, the value of the existing tag is overwritten.

Tag keys and tag values cannot start with aliyun or acs:, and cannot contain http:// or https://.

Response parameters

Parameter Type Example Description
RequestId String 7414187F-4F59-4585-9BCF-5F0804E4****

The ID of the request.

Message String success

The returned message.

TraceId String 0bc5f84e15916043198032146d****

The ID of the trace. It can be used to query the details of a request.

Data Object

The returned data.

NextToken String ""

A maximum of 50 entries can be returned for a query. If a query generates more than 50 entries, the NextToken parameter is returned with the first 50 entries. You can use the NextToken parameter value to retrieve the subsequent entries that are not returned in the current query result.

TagResources Array of TagResource

The mapping relationships between applications and tags.

ResourceType String ALIYUN::SAE::APPLICATION

The type of the resource. Set the value to application.

TagValue String v1

The tag value.

ResourceId String d42921c4-5433-4abd-8075-0e536f8b****

The ID of the application.

TagKey String k1

The tag key.

ErrorCode String This parameter is left empty.

The error code.

  • The ErrorCode parameter is not returned when the request succeeds.
  • The ErrorCode parameter is returned when the request fails. For more information, see Error codes in this topic.
Code String 200

The HTTP status code. Valid values:

  • 2xx: indicates that the request was successful.
  • 3xx: indicates that the request was redirected.
  • 4xx: indicates that the request was invalid.
  • 5xx: indicates that a server error occurred.
Success Boolean true

Indicates whether mapping relationships between applications and tags were queried successfully. Valid values:

  • true: The query was successful.
  • false: The query failed.

Examples

Sample requests

GET /tags?RegionId=cn-beijing&ResourceType=application&NextToken=A2RN&ResourceIds=["d42921c4-5433-4abd-8075-0e536f8b****"]&Tags=[{"key":"k1","value":"v1"}] HTTP/1.1
Host:sae.aliyuncs.com
Content-Type:application/json

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<ListTagResourcesResponse>
    <RequestId>7414187F-4F59-4585-9BCF-5F0804E4****</RequestId>
    <Message>success</Message>
    <TraceId>0bc5f84e15916043198032146d****</TraceId>
    <Data>
        <NextToken>""</NextToken>
        <TagResources>
            <ResourceType>ALIYUN::SAE::APPLICATION</ResourceType>
            <TagValue>v1</TagValue>
            <ResourceId>d42921c4-5433-4abd-8075-0e536f8b****</ResourceId>
            <TagKey>k1</TagKey>
        </TagResources>
    </Data>
    <Code>200</Code>
    <Success>true</Success>
</ListTagResourcesResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "7414187F-4F59-4585-9BCF-5F0804E4****",
  "Message" : "success",
  "TraceId" : "0bc5f84e15916043198032146d****",
  "Data" : {
    "NextToken" : "\"\"",
    "TagResources" : [ {
      "ResourceType" : "ALIYUN::SAE::APPLICATION",
      "TagValue" : "v1",
      "ResourceId" : "d42921c4-5433-4abd-8075-0e536f8b****",
      "TagKey" : "k1"
    } ]
  },
  "Code" : "200",
  "Success" : true
}

Error codes

HttpCode Error code Error message Description
400 InvalidParameter.Obviously The specified parameter is invalid {%s}. The value of the %s parameter is invalid.
400 InvalidResourceType.NotFound The specified resource type is not supported. The specified resource type is not supported.
400 NumberExceed.Tags The specified parameter Tags count exceed. The number of tags for a resource exceeds the limit of 20.
400 Invalid.Param.Tag.Scope The specified parameter is invalid: tag scope. The value of the scope parameter is invalid.
400 No.Permission The account has no permission. Your account does not have the operation permissions.
400 NumberExceed.ResourceIds The number of resource IDs cannot exceed 50. The number of resource IDs exceeds the limit of 50.

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