Batch Adding Resource Tags
Function
This API is idempotent and is used to batch add tags for a specified resource. You can add up to 20 tags to a resource.
Note: This api supports only resource type of Config. Currently, resource_type supports config:policyAssignments, config:aggregators, config:aggregationAuthorizations.
Calling Method
For details, see Calling APIs.
URI
POST /v1/resource-manager/{resource_type}/{resource_id}/tags/create
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
resource_type |
Yes |
String |
Resource type. |
|
resource_id |
Yes |
String |
Resource ID. |
Request Parameters
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
tags |
No |
Array of ResourceTag objects |
Specifies tags. For tenant permissions, this parameter is mandatory. For the op_service permission, choose either this parameter or sys_tags. Array Length: 1 - 20 |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
key |
Yes |
String |
Tag key. A tag key can contain up to 128 Unicode characters and must comply with the character set specifications in section 3.1. Minimum: 1 Maximum: 128 |
|
value |
Yes |
String |
Tag value. A tag value can contain up to 255 Unicode characters and must comply with the character set specifications in section 3.2. Minimum: 0 Maximum: 255 |
Response Parameters
Status code: 204
No content.
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
Adding Tags to Specified Instances in Batches
POST https://{endpoint}/v1/resource-manager/{resource_type}/{resource_id}/tags/create
{
"tags" : [ {
"key" : "key1",
"value" : "value1"
}, {
"key" : "key2",
"value" : "value2"
} ]
}
Example Responses
None
Status Codes
|
Status Code |
Description |
|---|---|
|
204 |
No content. |
|
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.