Updated on 2023-11-23 GMT+08:00

Adding a Resource Tag

Function

This API is used to add tags to 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

Request parameters

Table 2 Parameters in the request header

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

Message body type (format).

The default value application/json is recommended.

X-Auth-Token

Yes

String

User token. The token can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token.

Table 3 Parameters in the request body

Parameter

Mandatory

Type

Description

tag

Yes

tag object

Whether tags are contained.

Table 4 tag

Parameter

Mandatory

Type

Description

key

Yes

String

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

This parameter cannot be left blank and can contain only letters, digits, hyphens (-), and underscores (_).

value

Yes

String

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

This parameter cannot be left blank and can contain only letters, digits, hyphens (-), and underscores (_).

Example request

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

Error Codes

For details, see Error Codes.