Querying Resource Tags by Project
Function
This API is used to query tags of resources that are in a specified project.
Calling Method
For details, see Calling APIs.
URI
GET /v1/resource-manager/{resource_type}/tags
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
resource_type |
Yes |
String |
Resource type. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
limit |
No |
Integer |
Number of records that can be queried. The default value is 1000. The minimum value is 1. Minimum: 1 Maximum: 1000 Default: 1000 |
offset |
No |
Integer |
Index position. If the offset element is set to N, the resource query starts from the N+1 piece of data. If action is set to filter, the value of offset is 0 by default, indicating that the query starts from the first piece of data. The offset value must be a number and cannot be a negative number. Minimum: 0 Default: 0 |
Request Parameters
None
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
tags |
Array of Tag objects |
Tags. |
total_count |
Integer |
The total number of records. |
Parameter |
Type |
Description |
---|---|---|
key |
String |
Tag key. A key can contain up to 128 Unicode characters and cannot be left blank. The system does not verify the character set of the key when searching for resources. The key element cannot be empty, an empty string, or spaces. Before using the key element, delete single-byte character (SBC) spaces before and after the value. Minimum: 1 Maximum: 128 |
values |
Array of strings |
Tag values. A key can contain up to 255 Unicode characters. Before verifying or using the value element, delete single-byte character (SBC) spaces before and after the value. The value can be an empty array but cannot be left blank. If no value is specified, any values are supported. Values are in an Or relathionship. The system does not verify the character set of bvaluesb when searching for resources, but only verifies the length. Maximum: 255 Array Length: 0 - 20 |
Status code: 400
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Specifies the error code. |
error_msg |
String |
Specifies the error message. |
Status code: 401
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Specifies the error code. |
error_msg |
String |
Specifies the error message. |
Status code: 403
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Specifies the error code. |
error_msg |
String |
Specifies the error message. |
Status code: 404
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Specifies the error code. |
error_msg |
String |
Specifies the error message. |
Status code: 500
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Specifies the error code. |
error_msg |
String |
Specifies the error message. |
Example Requests
Querying All Resource Tag Sets of a Tenant Instance Type
GET https://{endpoint}/v1/resource-manager/{resource_type}/tags
Example Responses
Status code: 200
Succeeded.
{ "tags" : [ { "key" : "key1", "values" : [ "value1", "value2" ] }, { "key" : "key2", "values" : [ "value1", "value2" ] } ], "total_count" : 1001 }
Status Codes
Status Code |
Description |
---|---|
200 |
Succeeded. |
400 |
Invalid parameter. |
401 |
Unauthorized. |
403 |
Forbidden. |
404 |
Resources not found. |
500 |
Internal server error. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot