Help Center/ Cloud Backup and Recovery/ API Reference/ CBR APIs/ Tags/ Batch Adding or Deleting Tags of a Vault
Updated on 2022-09-19 GMT+08:00

Batch Adding or Deleting Tags of a Vault

Function

This API is used to batch add or delete tags for a specified instance. TMS uses this API to manage service resource tags. A resource can have a maximum of 10 tags. This API is idempotent. If there are duplicate keys in the request body when you add tags, an error is reported. If a to-be-added tag has the same key as an existing tag, the tag will be added and overwrite the existing tag. When deleting tags, you can upload duplicate keys. When deleting tags, if some tags do not exist, the deletion is considered to be successful by default. The character set of the tags will not be verified. A key and a value can individually consist of up to 127 and 255 characters. When you delete tags, the tags structure cannot be missing, and the key cannot be left blank or be an empty string.

URI

POST /v3/{project_id}/vault/{vault_id}/tags/action

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID

vault_id

Yes

String

Resource ID

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

tags

No

Array of Tag objects

Tag list

This list cannot be an empty list.

The list can contain up to 10 keys.

Keys in this list must be unique.

sys_tags

No

Array of SysTag objects

System tag list

This field is available only to the op_service permission. Choose either this field or tags.

Currently, TMS calls contain only one resource_tag structure. The key is fixed at as _sys_enterprise_project_id.

The value is the UUID or 0. Value 0 indicates the default enterprise project.

Currently, only the create operation is supported.

action

Yes

String

Operation to be performed. The value can be set to create or delete only.

Enumeration values:

  • create
  • delete

Response Parameters

Status code: 400

Table 3 Response body parameters

Parameter

Type

Description

error_code

String

For details, see Error Codes.

error_msg

String

Error message

Example Requests

Example request

POST  https://{endpoint}/v3/{project_id}/vault/{vault_id}/tags/action

{
  "tags" : [ {
    "key" : "string",
    "value" : "string"
  }, {
    "key" : "string1",
    "value" : "string2"
  } ],
  "action" : "create"
}

Example Responses

None

Status Codes

Status Code

Description

204

No Content

400

Bad Request

Error Codes

See Error Codes.