Help Center/ Enterprise Router/ API Reference/ APIs/ Tags/ Creating Resource Tags
Updated on 2024-04-25 GMT+08:00

Creating Resource Tags

Function

This API is used to create tags for resources of a specific type.

Constraints

  • A resource can have up to 10 tags.

  • This API is idempotent.

  • If a tag to be created has the same key as an existing tag, the tag will be created and overwrite the existing one.

Calling Method

For details, see Calling APIs.

URI

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

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID

resource_id

Yes

String

Resource ID

resource_type

Yes

String

Resource type.

  • instance: enterprise router

  • route-table: route table

  • vpc-attachment: VPC attachment

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

tag

Yes

Tag object

Resource tag

Table 3 Tag

Parameter

Mandatory

Type

Description

key

No

String

Tag key. The value can contain a maximum of 36 Unicode characters, including uppercase letters, lowercase letters, digits, hyphens (-), and underscores (_).

Minimum: 1

Maximum: 128

value

No

String

Tag value.

  • Tag values consist of letters, digits, spaces, and special characters _.:=+-@

  • Tag values can contain 0 to 255 characters.

  • Tag values can be left blank or set to null.

Minimum: 0

Maximum: 255

Response Parameters

None

Example Requests

Creating tags for a resource

POST https://{erouter-endpoint}/v3/cfa563efb77d4b6d9960781d82530fd8/instance/3320166e-b937-40cc-a35c-02cd3f2b3ee2/tags

{
  "tag" : {
    "key" : "key1",
    "value" : "value1"
  }
}

Example Responses

None

Status Codes

Status Code

Description

204

No Content

Error Codes

See Error Codes.