• Cloud Server Backup Service

csbs
  1. Help Center
  2. Cloud Server Backup Service
  3. API Reference
  4. API Description
  5. Tag Management
  6. Batch Adding or Deleting Tags of a Backup Resource

Batch Adding or Deleting Tags of a Backup Resource

Function

This API is used to add or delete tags of a specific instance in batches.

The TMS may use this API to manage service resource tags.

A resource can have up to 10 tags.

The API is idempotent.

If there are duplicate keys in the request body when you add tags, an error is reported.

If the key of the to-be-created tag is the same as that of an existing tag, the value of the existing tag will be overwritten.

When deleting tags, you can upload duplicate keys.

When tags are being deleted and some tags do not exist, the operation is considered successful by default, and the character set of the tags will not be checked upon deletion. A key and a value can respectively consist of up to 127 and 255 characters. The tag structure cannot be missing, and the key cannot be left blank or an empty string.

URI

  • URI format

    POST /v1/{project_id}/csbs_backup/{resource_id}/tags/action

  • Request header

    Parameter

    Mandatory

    Type

    Description

    Content-type

    MIME type of the body in the request

    Yes

    application/json

    X-Auth-Token

    User token

    Yes

    -

  • Parameter description

    Parameter

    Mandatory

    Type

    Description

    project_id

    Yes

    String

    Project ID

    resource_id

    Yes

    String

    Resource ID

Request

  • Element description

    Parameter

    Mandatory

    Type

    Description

    tags

    Yes

    List<resource_tag>

    Tag list

    This list cannot be an empty list.

    The list can contain up to 10 keys.

    Keys in this list must be unique.

    action

    Yes

    String

    Operator, which can be create or delete

  • Parameter description of field resource_tag

    Parameter

    Mandatory

    Type

    Description

    key

    Yes

    String

    Tag key (when action is set to create)

    It consists of up to 36 characters.

    It cannot be an empty string.

    Spaces before and after a key will be deprecated.

    It can contain only letters, digits, hyphens (-), and underscores (_).

    Tag key (when action is set to delete)

    It consists of up to 127 characters.

    It cannot be an empty string.

    Spaces before and after a key will be deprecated.

    value

    Yes

    String

    Tag value (when action is set to create)

    This parameter is mandatory.

    It consists of up to 43 characters.

    It can be an empty string.

    Spaces before and after a tag value will be deprecated.

    It can contain only letters, digits, hyphens (-), and underscores (_).

    Tag value (when action is set to delete)

    The tag value can be passed or not.

    It consists of up to 255 characters.

    It can be an empty string.

    Spaces before and after a tag value will be deprecated.

    If the value is not passed, the tag is located and deleted based on the key and value. If the value is passed, the tag is located and deleted based on the key.

  • Example request
    POST /v1/{project_id}/csbs_backup/{resource_id}/tags/action
  • Request body
    {
        "action": "create",
        "tags": [
            {
                "key": "key1",
                "value": "value1"
            },
            {
                "key": "key",
                "value": "value3"
            }
        ]
    }
    or
    {
        "action": "delete",
        "tags": [
            {
                "key": "key1",
                "value": "value1"
            },
            {
                "key": "key2",
                "value": "value3"
            }
        ]
    }
    

Response

  • Element description

None

Status Codes

  • Normal

    Status Code

    Description

    204

    No Content

  • Abnormal

    Status Code

    Description

    400

    Invalid action.

    401

    Authentication failed.

    403

    You do not have permission to perform this operation.

    404

    The requested resource was not found.

    500

    A system exception occurs.

Error Codes

For details, see Error Codes.