- API Reference
- API Description
- Resource Tags
- Querying Resource Tags
Querying Resource Tags¶
Function¶
You can use this API to query tags of a specific resource.
URI¶
GET /v2.0/resources/{resource_id}/tags
Parameter | Mandatory | Type | Description |
---|---|---|---|
resource_id | Yes | String | Specifies the resource ID. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
project_id | No | String | Specifies the project ID. This parameter is mandatory for region-level resources. |
resource_type | Yes | String | Specifies the resource type. |
Request¶
Parameter | Mandatory | Type | Description |
---|---|---|---|
X-Auth-Token | Yes | String | Specifies the user token. TMS is a global service. So you need to set scope to domain when calling an IAM API to obtain a user token. The value of X-Subject-Token in the response header is the user token. |
Response¶
Status code: 200
Parameter | Type | Description |
---|---|---|
key | String | Specifies the key. It can contain up to 36 characters. The key cannot be empty. Only digits, letters, hyphens (-), at signs (@), and underscores (_) are allowed. |
value | String | Specifies the value. Each value contains a maximum of 43 Unicode characters and can be an empty string. Only digits, letters, hyphens (-), at signs (@), and underscores (_) are allowed. |
Example Request¶
Querying tags of a resource
GET https://{Endpoint}/v2.0/resources/xxxx/tags?project_id=xxxx&resource_type=disk
Example Response¶
Status code: 200
Successful operation
{
"tags" : [ {
"key" : "key1",
"value" : "value1"
}, {
"key" : "key2",
"value" : "value2"
} ]
}
Status Codes¶
See Status Codes.
Error Codes¶
See Error Codes.