Updated on 2023-08-24 GMT+08:00

Adding a Domain Name to WAF

Function

This API is used to add a domain name to WAF.

URI

POST /v1/edgewaf/domains

Request Parameters

Table 1 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token. It can be obtained by calling the IAM API (value of X-Subject-Token in the response header).

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

domain_name

Yes

String

Protected domain name, which can be obtained by calling the CDN domain name query API. The domain name can contain a port number.

enterprise_project_id

No

String

Obtain the enterprise project ID by calling the ListEnterpriseProject API of Enterprise Project Management Service (EPS).

policy_id

No

String

ID of the policy associated with the protected domain name. It can be obtained by calling the API for querying WAF protection policies.

certificate_id

No

String

Certificate ID, which is obtained through the ListCertificates API.

  • This parameter is not required if the client protocol is HTTP.

  • This parameter is mandatory if the client protocol is HTTPS.

  • If the API for querying the certificate list is unavailable, log in to the EdgeSec console, and obtain the certificate ID from the certificate management page of Edge WAF.

web_tag

No

String

Domain name.

description

No

String

Domain name description.

area_type

Yes

String

Region that the domain name belongs to. Obtain the value by calling the API for querying the CDN domain name.

Enumeration values:

  • mainland_china

  • outside_mainland_china

  • global

  • europe

Response Parameters

Status code: 400

Table 3 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Status code: 401

Table 4 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Status code: 500

Table 5 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Example Requests

Add domain_name to be protected by WAF.

POST https://{Endpoint}/v1/edgewaf/domains

{
  "domain_name" : "domain_name",
  "enterprise_project_id" : 0,
  "policy_id" : "1771a426afcc4e16b8636cb72c2d53e4",
  "web_tag" : "domain_name",
  "description" : "demo",
  "area_type" : "outside_mainland_china"
}

Example Responses

None

Status Codes

Status Code

Description

200

Request succeeded.

400

Request failed.

401

The token does not have required permissions.

500

Internal server error.

Error Codes

See Error Codes.