Updated on 2024-12-05 GMT+08:00

Create tags

Function

Creating tags for firewalls.

Calling Method

For details, see Calling APIs.

URI

POST /v2/{project_id}/cfw-cfw/{fw_instance_id}/tags/create

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

project ID

fw_instance_id

Yes

String

Firewall instance ID, which is automatically generated after a CFW instance is created. You can obtain the ID by calling the API used for querying a firewall instance. For details, see the API Explorer and Help Center FAQ.By default, if fw_instance_Id is not specified, information about the first firewall under the account is returned. If fw_instance_Id is specified, information about the firewall with this fw_instance_Id is returned.If object_Id is specified, information about the firewall with this object_Id is returned by default. If both fw_instance_Id and object_Id are specified, the specified object_Id must belong to the specified firewall.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token. It 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 a token.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

tags

No

Array of CreateTag objects

tag list

Table 4 CreateTag

Parameter

Mandatory

Type

Description

key

No

String

key

value

No

String

value

Response Parameters

None

Example Requests

Add a tag to the project ID 0b2179bbe180d3762fb0c01a2d5725c7 and the firewall ID 5e7eba7f-5de4-4ce9-8f60-11330dfc6565 with the keytest key and valuetest valuetest.

https://{Endpoint}/v2/0b2179bbe180d3762fb0c01a2d5725c7/cfw-cfw/5e7eba7f-5de4-4ce9-8f60-11330dfc6565/tags/create

{
  "tags" : [ {
    "key" : "keytest",
    "value" : "valuetest"
  } ]
}

Example Responses

None

Status Codes

Status Code

Description

200

OK

Error Codes

See Error Codes.