Help Center> Cloud Backup and Recovery> API Reference> CBR APIs> Tags> Batch Adding or Deleting Tags of a Vault

Batch Adding or Deleting Tags of a Vault

Function

This API is used to add or delete tags for a specified resource in batches.

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-created tag has the same key as an existing tag, the tag will be created and overwrite the existing one. When deleting tags, you can upload duplicate keys. When deleting tags, if some tags do not exist, the operation is considered to be successful by default. The character set of the tags will not be checked. A key and a value can respectively consist of up to 127 and 255 characters. When you delete tags, the tag 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 invokes only one resource_tag structure. The key is fixed at as _sys_enterprise_project_id.

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

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

Table 3 Tag

Parameter

Mandatory

Type

Description

key

Yes

String

Key.

It consists of up to 36 characters.

It cannot be an empty string.

Spaces before and after a key will be deprecated.

It cannot contain ASCII (0-31) or the following characters: =*<>,|/

It can contain only Chinese characters, letters, digits, hyphens, and underscores.

value

No

String

Value.

The value of this parameter is mandatory when a tag is added and optional when a tag is deleted.

It consists of up to 43 characters.

It can be an empty string.

Spaces before and after a value will be deprecated.

It cannot contain ASCII (0-31) or the following characters: =*<>,|/

It can contain only Chinese characters, letters, digits, hyphens, and underscores.

Table 4 SysTag

Parameter

Mandatory

Type

Description

key

Yes

String

Key. Key of the system tag, which is obtained from the whitelist and cannot be defined randomly. Currently, only the _sys_enterprise_project_id field is supported, and the corresponding value indicates the enterprise project ID.

value

Yes

String

Value. Currently, only the enterprise project ID is used. The default enterprise project ID is 0.

Response Parameters

Status code: 400

Table 5 Response body parameters

Parameter

Type

Description

error_code

String

For details, see Error Codes.

error_msg

String

Error message

Example Requests

None

Example Responses

None

Status Codes

Status Code

Description

204

No Content

400

Bad Request

Error Codes

See Error Codes.