Help Center> Cloud Backup and Recovery> API Reference> CBR APIs> Tags> Adding a Tag to an Associated Resource

Adding a Tag to an Associated Resource

Function

This API is used to add a tag to an associated resource. A resource can have a maximum of 10 tags.

The API is idempotent. If a to-be-created tag has the same key as an existing tag, the tag will be created and overwrite the existing one.

URI

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

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

tag

No

Tag object

Tag

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.

Response Parameters

Status code: 400

Table 4 Response body parameters

Parameter

Type

Description

error_code

String

For details, see Error Codes.

error_msg

String

Error message

Example Requests

{
  "tag" : {
    "key" : "key1",
    "value" : "key2"
  }
}

Example Responses

None

Status Codes

Status Code

Description

204

No Content

400

Bad Request

Error Codes

See Error Codes.