Help Center> Intelligent EdgeFabric> API Reference> API> Tag Management> Adding or Deleting Resource Tags in Batches

Adding or Deleting Resource Tags in Batches

Function

This API is used to add or delete tags in batches for a specified instance.

A resource can have a maximum of 20 tags.

  • This API is an idempotent API. If the request body contains duplicate keys during tag creation, an error is reported.
  • During tag creation, duplicate key data is not allowed. If the key already exists in the database, its value is overwritten.
  • When a tag is deleted, the character set range of the tag is not verified. If the tag to be deleted does not exist, the deletion is successful by default. The tags structure cannot be missing during deletion. The key cannot be empty or an empty string.

URI

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

Table 1 Path parameters

Parameter

Type

Description

project_id

String

Project ID. For details about how to obtain a project ID, see Obtaining a Project ID.

resource_type

String

Resource type.

  • ief-edge_node
  • ief-deployment
  • ief-application
  • ief-device

resource_id

String

Resource ID.

Request

Table 2 Body parameters

Parameter

Mandatory

Type

Description

tags

No

Array of resource_tag objects

List of tags.

action

Yes

String

Operation to be performed, which can be create or delete.

Table 3 resource_tag

Parameter

Mandatory

Type

Description

key

Yes

String

Tag key, which can contain a maximum of 36 Unicode characters.

The key cannot be left blank and can contain only uppercase letters, lowercase letters, digits, hyphens (-), and underscores (_).

value

Mandatory when action is set to create; optional when action is set to delete

String

Tag value. Each value can contain a maximum of 43 Unicode characters. If value is specified, tags are deleted by key and value. If value is not specified, tags are deleted by key.

The value cannot be left blank and can contain only uppercase letters, lowercase letters, digits, hyphens (-), and underscores (_).

Request example

{
    "action": "create",
    "tags": [
        {
            "key": "key0",
            "value": "value1_new1"
        },
        {
            "key": "key1",
            "value": "value3_new"
        },
        {
            "key": "key2",
            "value": "value1_new1"
        },
        {
            "key": "key3",
            "value": "value3_new"
        },
        {
            "key": "key4",
            "value": "value1_new1"
        },
        {
            "key": "key5",
            "value": "value3_new"
        },
        {
            "key": "key6",
            "value": "value1_new1"
        },
        {
            "key": "key7",
            "value": "value3_new"
        },
        {
            "key": "key8",
            "value": ""
        }
    ]
}

Response

None

Error Codes

For details, see Error Codes.