Help Center> Edge Security> API Reference> API> WAF Domain Name Management> Updating Domain Names in a Protection Policy
Updated on 2023-08-24 GMT+08:00

Updating Domain Names in a Protection Policy

Function

This API is used to update domain names a policy applies to.

URI

POST /v1/edgewaf/policies/{policy_id}/hosts

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

policy_id

Yes

String

Protection policy ID, which can be obtained by querying the policy list (ListPolicy).

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 (value of X-Subject-Token in the response header).

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

enterprise_project_id

No

String

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

hosts

Yes

Array of strings

ID of the domain name to be associated.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

id

String

Policy ID.

name

String

Policy name.

action

WafPolicyAction object

Protection action

options

WafPolicyOption object

Whether a protection item is enabled in a protection policy.

level

Integer

Protection level.

full_detection

Boolean

Detection mode in the precise protection rule.

robot_action

WafPolicyAction object

Information about anti-crawler protection with feature libraries

bind_host

Array of WafPolicyBindHost objects

Basic information about the protected domain.

timestamp

Long

Time a policy was created.

extend

Map<String,String>

Extended field.

Table 5 WafPolicyOption

Parameter

Type

Description

webattack

Boolean

Whether basic web protection is enabled.

Enumeration values:

  • true

  • false

common

Boolean

Whether general check is enabled.

Enumeration values:

  • true

  • false

bot_enable

Boolean

Whether full anti-crawler protection is enabled.

Enumeration values:

  • true

  • false

crawler

Boolean

Whether anti-crawler protection with feature libraries is enabled.

Enumeration values:

  • true

  • false

crawler_engine

Boolean

Whether the search engine is enabled.

Enumeration values:

  • true

  • false

crawler_scanner

Boolean

Whether the scanner is enabled.

Enumeration values:

  • true

  • false

crawler_script

Boolean

Whether the JavaScript anti-crawler is enabled.

Enumeration values:

  • true

  • false

crawler_other

Boolean

Whether other crawler check is enabled.

Enumeration values:

  • true

  • false

webshell

Boolean

Whether web shell detection is enabled

Enumeration values:

  • true

  • false

cc

Boolean

Whether the CC attack protection rules are enabled.

Enumeration values:

  • true

  • false

custom

Boolean

Whether precise protection is enabled.

Enumeration values:

  • true

  • false

followed_action

Boolean

Whether known attack source detection is enabled.

Enumeration values:

  • true

  • false

whiteblackip

Boolean

Whether blacklist and whitelist protection is enabled.

Enumeration values:

  • true

  • false

geoip

Boolean

Whether the geolocation rule is enabled.

Enumeration values:

  • true

  • false

ignore

Boolean

Whether false alarm masking is enabled.

Enumeration values:

  • true

  • false

privacy

Boolean

Whether data masking is enabled.

Enumeration values:

  • true

  • false

antitamper

Boolean

Whether the web tamper protection is enabled.

Enumeration values:

  • true

  • false

antileakage

Boolean

Whether the information leakage prevention is enabled.

Enumeration values:

  • true

  • false

anticrawler

Boolean

Whether the JavaScript anti-crawler rule is enabled.

Enumeration values:

  • true

  • false

Table 6 WafPolicyAction

Parameter

Type

Description

category

String

Basic web protection action (log: record only; block: block)

Enumeration values:

  • block

  • log

followed_action_id

String

Known attack source rule ID

Table 7 WafPolicyBindHost

Parameter

Type

Description

id

String

Domain name ID.

hostname

String

Domain name.

Status code: 400

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Status code: 401

Table 9 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Status code: 500

Table 10 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Example Requests

Apply the policy whose ID is 1771a426afcc4e16b8636cb72c2d53e4 to the domain name whose ID is 095b60b21ac248579426f97379b3fbec.

POST https://{Endpoint}/v1/edgewaf/policies/1771a426afcc4e16b8636cb72c2d53e4/hosts

{
  "enterprise_project_id" : 0,
  "hosts" : [ "095b60b21ac248579426f97379b3fbec" ]
}

Example Responses

Status code: 200

Request succeeded.

{
  "id" : "1771a426afcc4e16b8636cb72c2d53e4",
  "name" : "demo_policy",
  "action" : {
    "category" : "log"
  },
  "options" : {
    "webattack" : true,
    "common" : true,
    "bot_enable" : true,
    "crawler" : true,
    "crawler_engine" : false,
    "crawler_scanner" : true,
    "crawler_script" : false,
    "crawler_other" : false,
    "webshell" : false,
    "cc" : true,
    "custom" : true,
    "followed_action" : false,
    "whiteblackip" : true,
    "geoip" : true,
    "ignore" : true,
    "privacy" : true,
    "antitamper" : true,
    "antileakage" : false,
    "anticrawler" : false
  },
  "level" : 2,
  "full_detection" : false,
  "robot_action" : {
    "category" : "log"
  },
  "bind_host" : [ {
    "id" : "095b60b21ac248579426f97379b3fbec",
    "name" : "domain_name"
  } ],
  "timestamp" : 1691478911117
}

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.