Help Center/ Database Security Service/ API Reference/ API/ TMS Tags/ Adding Resource Tags in Batches

Adding Resource Tags in Batches

Updated on 2025-06-19 GMT+08:00

Function

This API is used to add resource tags in batches.

Calling Method

For details, see Calling APIs.

URI

POST /v1/{project_id}/{resource_type}/{resource_id}/tags/create

Table 1 URI parameter

Parameter

Mandatory

Parameter Type

Description

project_id

Yes

String

Project ID.

resource_type

Yes

String

Resource type.

  • auditInstance

resource_id

Yes

String

Resource ID You can obtain the value from the resource_id field in the API for querying the instance list.

Request Parameter

Table 2 Request header parameter

Parameter

Mandatory

Parameter Type

Description

X-Auth-Token

Yes

String

User token. The token can be queried by calling the IAM API. (The token is the value of X-Subject-Token in the response header.)

Table 3 Request body parameter

Parameter

Mandatory

Parameter Type

Description

tags

No

Array of tags objects

Tags.

This parameter is mandatory for the tenant permission. For the op_service permission, either tags or sys_tags can be set.

sys_tags

No

Array of sys_tags 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 as _sys_enterprise_project_id.

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

Table 4 tags

Parameter

Mandatory

Parameter Type

Description

key

Yes

String

Key. The value can contain up to 128 characters.

value

Yes

String

Value. Each value can contain a maximum of 255 characters.

Table 5 sys_tags

Parameter

Mandatory

Parameter Type

Description

key

Yes

String

Key. The value can contain up to 128 characters.

value

Yes

String

Value. Each value can contain a maximum of 255 characters.

Response Parameter

Status code: 204

Table 6 Response body parameters

Parameter

Parameter Type

Description

-

String

-

Status code: 400

Table 7 Response body parameter

Parameter

Parameter Type

Description

error

Object

Error message.

Table 8 ErrorDetail

Parameter

Parameter Type

Description

error_code

String

Error code

error_msg

String

Error message

Status code: 403

Table 9 Response body parameter

Parameter

Parameter Type

Description

error

Object

Error message.

Table 10 ErrorDetail

Parameter

Parameter Type

Description

error_code

String

Error code

error_msg

String

Error message

Status code: 500

Table 11 Response body parameters

Parameter

Parameter Type

Description

error

Object

Error message.

Table 12 ErrorDetail

Parameter

Parameter Type

Description

error_code

String

Error code

error_msg

String

Error message

Example Request

/v1/{project_id}/{resource_type}/{resource_id}/tags/create

{
  "tags" : [ {
    "key" : "key1",
    "value" : "value1"
  } ]
}

Response Examples

Status code: 400

Failed

{
  "error" : {
    "error_code" : "DBSS.XXXX",
    "error_msg" : "XXX"
  }
}

Status Code

Status Code

Description

204

Request succeeded.

400

Failed

403

Authentication failed.

500

Server error.

Error Codes

For details, see Error Codes.

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback