Check the Resources Bound to the Tag
Last Updated:2020-10-22
Description
- This API is used to list the resources bound under all tags conforming to conditions.
- If no resource exists under the tag conforming to conditions, this tag does not appear in the return results.
- This API is used to return the bound resource ID. For the resource details, see API of various products.
Request
Request structure
GET /v{version}/tag/tagResources?tagKey={tagkey}&tagValue={tagValue}®ion={region}&resourceType={resourceType} HTTP/1.1
Host: tag.baidubce.com
Authorization: authorization string
Request Header Field
There are no other special header fields except the public header field.
Request Parameters
Parameter Name | Type | Required | Parameter Position | Description |
---|---|---|---|---|
version | String | Yes | URL parameter | API version number |
tagKey | String | No | Query parameter | Tag key to query. When this option does not appear or is empty, it indicates to query all tag keys. |
tagValue | String | No | Query parameter | Tag value to query. When this option does not appear, it indicates to query all tag values. When this option is empty, it indicates that the tag value to query is the empty string. |
region | [Region](BCC/Tag Service API Reference/Appendix1.md#Region) | No | Query parameter | Region to query. If this option does not appear or is empty, it indicates to query all regions. |
resourceType | ResourceType | No | Query parameter | Resource type to query. If this option does not appear or is empty, it indicates to query all resource types. |
Return
Return a header field
There are no other special header fields except the common header field.
Return Parameter
Parameter Name | Type | Description |
---|---|---|
tagResources | List<TagResource> | Tags conforming to conditions and corresponding resource list. If no tag conforms to conditions, it returns an empty array. |
Error Code
Without special return error code
Example
Request Example
GET /v1/tag/tagResources?tagKey=key1&tagValue=value1®ion=bj HTTP/1.1 HTTP/1.1
Host: tag.baidubce.com
Authorization: bce-auth-v1/62f0900586964cb2b76bcd221969eb0f/2018-04-09T00:00:00Z/1800/host/36e62c42e473576adb1510edf64dfd6e685982b833de9c657594ca7e78da0401
Return Example
cache-control: no-cache
content-length: 0
content-type: text/plain; charset=utf-8
date: Mon, 09 Apr 2018 00:00:00 GMT
server: BWS
x-bce-request-id: 160c0ea9-134e-45af-83c8-c17cea8443fa
{
"tagResources": [
{
"tagKey": "key1",
"tagValue": "value1",
"resources": [
{
"resourceType": "BCC",
"resourceId": "i-WosX2TgK",
"region": "bj"
},
{
"resourceType": "BOS",
"resourceId": "tag-test",
"region": "bj"
}
]
}
]
}