Updated on 2025-08-13 GMT+08:00

Batch Adding or Deleting Tags

Function

This API is used to add or delete tags in batches.

This API will be unavailable on June 30, 2025. You are advised to switch workloads to the new APIs (Adding Resource Tags in Batches and Deleting Resource Tags in Batches) before then.

URI

POST /v5/{project_id}/jobs/{resource_type}/{job_id}/tags/action

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID of a tenant in a region.

For details, see Obtaining a Project ID.

resource_type

Yes

String

Resource type.

  • migration: real-time migration.
  • sync: real-time synchronization.
  • cloudDataGuard: real-time disaster recovery.
  • subscription: data subscription.
  • backupMigration: backup migration.
  • replay: simulation replay.

job_id

Yes

String

Task ID.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

MIME type of the request body. Use the default value application/json. For APIs used to upload objects or images, the value varies depending on the flow type.

The default value is application/json.

X-Auth-Token

Yes

String

User token obtained from IAM. It is a response to the API for obtaining a user token. After a request is processed, the value of X-Subject-Token in the header is the token value.

X-Language

No

String

Request language type.

Default value: en-us

Enumerated values:

  • en-us
  • zh-cn
Table 3 Request body parameters

Parameter

Mandatory

Type

Description

action

Yes

String

Specifies the operation ID. The value is case-sensitive and can be any of the following:

  • create: creation operation.
  • delete: deletion operation.

Enumerated values:

  • create
  • delete

tags

Yes

Array of objects

Tag list. A maximum of 20 tags can be added.

For details, see Table 4.

Table 4 Data structure description of field tags

Parameter

Mandatory

Type

Description

key

Yes

String

Tag key.

  • It must consist of 1 to 128 Unicode characters,
  • including letters, digits, spaces, and special characters _.:=+-@. However, it cannot start or end with a space, or start with _sys_.

Minimum length: 1

Maximum length: 128

value

No

String

Tag value. This parameter is optional for deleting a tag.

  • Each tag value can contain a maximum of 255 Unicode characters.
  • The value can contain letters of any language, digits, spaces, and special characters _.:=+-@

Maximum length: 255

Response Parameters

None

Example Request

  • Adding tags in batches
    https://{endpoint}/v5/246765b9f59445c3919fce121ea801f4/jobs/sync/ada96925-ceb7-4fa7-8b6f-a344f84jb201/tags/action
    
    {
      "action" : "create",
      "tags" : [ {
        "key" : "aaa",
        "value" : "bbb"
      }, {
        "key" : "test",
        "value" : "test111"
      } ]
    }
  • Deleting tags in batches
    https://{endpoint}/v5/246765b9f59445c3919fce121ea801f4/jobs/sync/ada96925-ceb7-4fa7-8b6f-a344f84jb201/tags/action
    
    {
      "action" : "delete",
      "tags" : [ {
        "key" : "aaa",
        "value" : "bbb"
      }, {
        "key" : "test",
        "value" : "test111"
      } ]
    }

Example Response

Status code: 204

No Content

Status Code

Status Code

Description

204

No Content

Error Code

For details, see Error Code.