View resources bound to a tag
Updated at:2025-10-20
Description
- This API retrieves a list of all resources associated with given tags.
- Tags without any associated resources will not appear in the results.
- This API provides IDs of bound resources. For detailed information, use the respective product APIs.
Request
Request structure
Plain Text
1GET /v{version}/tag/tagResources?tagKey={tagkey}&tagValue={tagValue}®ion={region}&resourceType={resourceType} HTTP/1.1
2Host: tag.baidubce.com
3Authorization: authorization string
Request headers
There are no special headers required beyond the common headers.
Request parameters
| Parameter name | Types | Whether required | Parameter location | Description |
|---|---|---|---|---|
| version | String | Yes | URL parameter | API version number |
| tagKey | String | No | Query | The tag key to be queried. If this item is absent or empty, all tag keys shall be queried. |
| tagValue | String | No | Query | The tag value to be queried. If this item is absent, all tag values shall be queried. If it is empty, tag values with an empty string shall be queried. |
| region | [Region](BCC/Tag Service API Reference/Appendix 1.md#Region) | No | Query | Region to be queried. If this item is absent or empty, all regions shall be queried. |
| resourceType | [ResourceType](BCC/Tag Service API Reference/Appendix 1.md#ResourceType) | No | Query | Resource type to be queried. If this item is absent or empty, all resource types shall be queried. |
Response
Response headers
No special headers are required beyond the standard ones.
Response parameters
| Parameter name | Types | Description |
|---|---|---|
| tagResources | List<[TagResource](BCC/Tag Service API Reference/Appendix 1.md#TagResource)> | List of matching tags and their corresponding resources. Return empty array in case of no matching tags. |
Error code
No special error codes are returned
Example
Request example
Plain Text
1GET /v1/tag/tagResources?tagKey=key1&tagValue=value1®ion=bj HTTP/1.1 HTTP/1.1
2Host: tag.baidubce.com
3Authorization: bce-auth-v1/62f0900586964cb2b76bcd221969eb0f/2018-04-09T00:00:00Z/1800/host/36e62c42e473576adb1510edf64dfd6e685982b833de9c657594ca7e78da0401
Response example
Plain Text
1cache-control: no-cache
2content-length: 0
3content-type: text/plain; charset=utf-8
4date: Mon, 09 Apr 2018 00:00:00 GMT
5server: BWS
6x-bce-request-id: 160c0ea9-134e-45af-83c8-c17cea8443fa
7
8{
9 "tagResources": [
10 {
11 "tagKey": "key1",
12 "tagValue": "value1",
13 "resources": [
14 {
15 "resourceType": "BCC",
16 "resourceId": "i-WosX2TgK",
17 "region": "bj"
18 },
19 {
20 "resourceType": "BOS",
21 "resourceId": "tag-test",
22 "region": "bj"
23 }
24 ]
25 }
26 ]
27}
