Queries the tag list of associated instances.

  • To determine the search object, the request should include the parameter ResourceId.N or Tag.N (that is, Tag.N.Key and Tag.N.Value).
  • Tag.N is a tag and consists of a key-value pair. If only Tag.N.Key is specified, all tag values associated with the specified tag key are returned. If only Tag.N.Value is specified, an error is reported.
  • If you specify both Tag.N and ResourceId.N, the specified resource must match all the tag key-value pairs.
  • If you specify multiple tag key-value pairs, the resources that match the specified key-value pairs are returned.

Make the API call

You can use OpenAPI Explorer to make API calls, search for API calls, perform debugging, and generate SDK example code.

Request parameters

Parameter Type Required? Example value Description
Action String Yes ListTagResources

The name of this action.

Value: ListTagResources

RegionId String Yes cn-hangzhou

The ID of the region to which the Server Load Balancer (SLB) instance belongs.

To query the region ID, call DescribeRegions.

ResourceType String Yes instance

The type of the resource. Valid values:

  • Instance: SLB instance
  • certificate: certificate
  • acl: access control list
NextToken String No caeba0bbb2be03f84eb48b699f0a4883

The token for the next query.

ResourceId.N RepeatList No lb-bp1qnnvj18yy6h******

The ID of the resource. Value range of N: 1 to 20.

Tag.N.Key String No FinanceDept

The tag key of the resource. Value range of N: 1 to 20.

If you specify this parameter, the value of this parameter cannot be a null string. The value can be 64 characters in length and cannot start with aliyun or acs:. It cannot contain http:// or https://.

Tag.N.Value String No FinanceJoshua

The tag value of the resource. Value range of N: 1 to 20. If you specify this parameter, the value of this parameter cannot be a null string.

The value can be 128 characters in length and cannot start with aliyun or acs:. It cannot contain http:// or https://.

Response parameters

Parameter Type Example value Description
RequestId String DE65F6B7-7566-4802-9007-96F2494AC512

The ID of the request.

NextToken String caeba0bbb2be03f84eb48b699f0a4883

The token for the next query.

TagResources Array

The list of the resources with which the tags are associated.

TagResource

The details of the resource with which the tags are associated.

ResourceId String lb-bp16qjewdsunr4******

The ID of the resource.

ResourceType String instance

The type of the resource.

TagKey String FinanceDept

The tag key.

TagValue String FinanceJoshua

The value of the tag.

Examples

Request example


http(s)://[Endpoint]/? Action=ListTagResources
&RegionId=cn-hangzhou
&ResourceType=instance
&ResourceId.1=lb-bp16qjewdsunr41m1****
&<CommonParameters>

Response example

XML format

<ListTagResourcesResponse>
  <TagResources>
        <TagResource>
              <ResourceType>instance</ResourceType>
              <TagValue>FinanceJoshua</TagValue>
              <ResourceId>lb-bp16qjewdsunr41m1****</ResourceId>
              <TagKey>FinanceDept</TagKey>
        </TagResource>
  </TagResources>
  <NextToken>caeba0bbb2be03f84eb48b699f0a4883</NextToken>
  <RequestId>DE65F6B7-7566-4802-9007-96F2494AC512</RequestId>
</ListTagResourcesResponse>

JSON format

{
	"TagResources":{
		"TagResource":[
			{
				"ResourceType":"instance",
				"TagValue":"FinanceJoshua",
				"ResourceId":"lb-bp16qjewdsunr41m1****",
				"TagKey":"FinanceDept"
			}
		]
	},
	"NextToken":"caeba0bbb2be03f84eb48b699f0a4883",
	"RequestId":"DE65F6B7-7566-4802-9007-96F2494AC512"
}

Errors

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