Help Center/ VPC Endpoint/ API Reference/ API/ Tags/ Batch Adding or Deleting Tags to or from a Resource
Updated on 2025-05-15 GMT+08:00

Batch Adding or Deleting Tags to or from a Resource

Function

This API is used to batch add or delete tags to and from a specified VPC endpoint service or VPC endpoint.

Calling Method

For details, see Calling APIs.

URI

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

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Specifies the project ID.

resource_type

Yes

String

Specifies the resource type.

  • endpoint_service: indicates the VPC endpoint service.

  • endpoint: indicates the VPC endpoint.

resource_id

Yes

String

Specifies the resource ID, which can be the ID of a VPC endpoint service or a VPC endpoint.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Specifies the user token. It can be obtained by calling the IAM API. The value of X-Subject-Token in the response header is the user token.

Content-Type

No

String

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

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

tags

No

Array of ResourceTag objects

Specifies the tag list. If no tag is matched, an empty array is returned.

action

Yes

String

Specifies the operation to be performed, which only can be:

  • create

  • delete

Table 4 ResourceTag

Parameter

Mandatory

Type

Description

key

Yes

String

Specifies the tag key. A key can contain up to 128 Unicode characters.

The key must comply with the tag key configuration requirements.

value

No

String

Specifies the tag value. value is mandatory when action is set to create. Each value can contain a maximum of 255 Unicode characters. If value is specified, tags are deleted by key and value. If value is not specified, tags are deleted by key. The tag value must comply with the tag value configuration requirements.

Response Parameters

None

Example Requests

  • Adding resource tags

    POST https://{endpoint}/v1/{project_id}/endpoint_service/{resource_id}/tags/action
    
    {
      "action" : "create",
      "tags" : [ {
        "key" : "key1",
        "value" : "value1"
      }, {
        "key" : "key",
        "value" : "value3"
      } ]
    }
  • Deleting resource tags

    POST https://{endpoint}/v1/{project_id}/endpoint/{resource_id}/tags/action
    
    {
      "action" : "delete",
      "tags" : [ {
        "key" : "key1"
      }, {
        "key" : "key2",
        "value" : "value3"
      } ]
    }

Example Responses

None

Status Codes

Status Code

Description

204

The server has successfully processed the request.

Error Codes

See Error Codes.