Adding a Resource Tag

Function

This API is used to add tags for a resource.

A resource can have a maximum of 20 tags.

This API is an idempotent API. If the tag to be created already exists (with the same key), the existing tag will be overwritten.

URI

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

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

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

resource_type

Yes

String

Resource type.

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

resource_id

Yes

String

Resource ID.

Request

Table 2 Body parameter

Parameter

Mandatory

Type

Description

tag

Yes

tag object

Whether tags are contained.

Table 3 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

Yes

String

Tag value. Each value can contain a maximum of 43 Unicode characters.

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

Request example:

{
    "tag": {
        "key": "key0",
        "value": "ief-tag-test"
    }
}

Error Codes

For details, see Error Codes.