Updated on 2026-01-06 GMT+08:00

Querying a Precise Protection Rule

Function

This API is used to query a precise protection rule.

Calling Method

For details, see Calling APIs.

URI

GET /v2/aad/policies/waf/custom-rule

Table 1 Query Parameters

Parameter

Mandatory

Type

Description

domain_name

Yes

String

Domain name

overseas_type

Yes

Integer

Protection region. 0: regions in the Chinese mainland. 1: regions outside the Chinese mainland.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

token

Content-Type

Yes

String

Content-Type

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

total

Integer

Total

items

Array of WafCustomRule objects

Data item

Table 4 WafCustomRule

Parameter

Type

Description

id

String

id

name

String

name

time

Boolean

Time the precise protection rule takes effect. true: custom. false: immediate.

start

Long

Timestamp (s) when the precise protection rule takes effect.

terminal

Long

Timestamp (s) when the precise protection rule expires.

priority

Integer

Priority of the rule. A smaller value indicates a higher priority. Value range: 0 to 1,000.

conditions

Array of WafCustomCondition objects

condition

action

WafCustomRuleAction object

action

domain_name

String

Domain name

overseas_type

Integer

Protection region. 0: regions in the Chinese mainland. 1: regions outside the Chinese mainland.

Table 5 WafCustomCondition

Parameter

Type

Description

category

String

Field type

Enumeration values:

url: path

ip: IPv4

user-agent: User Agent

method: Method

referer: Referer

params: Params

cookie: Cookie

header: Header

request_line: Request Line

request: Request

index

String

Subfield.

  • If the field type is url, user-agent, refer, request_line, method, or request, index does not need to be set.

  • If the field type is ip or ipv6, index must be set to one of the following:

  • If category is set to params, cookie, or header, this parameter is mandatory. Set this parameter based on the site requirements.

  • If the matching logic is set to num_greater, num_less, num_equal, or** num_not_equal**, this parameter must be left empty.

  • If this parameter is not left empty, the maximum length cannot exceed 2,048 characters.

client-ip: client IP addresses.

x-forwarded-for: X-Forwarded-For

$remote_addr: TCP connection IP addresses

logic_operation

String

Condition matching logic.

If category is set to url, user-agent, or referer, the matching logic can be contain, not_contain, equal, not_equal, prefix, not_prefix, suffix, not_suffix, len_greater, len_less, len_equal, or len_not_equal.

If category is set to ip, ipv6, or method, the matching logic can be equal or not_equal.

If category is set to request_line or request, the matching logic can be len_greater, len_less, len_equal, or len_not_equal.

If category is set to params, cookie, or header, the matching logic can be contain, not_contain, equal, not_equal, prefix, not_prefix, suffix, not_suffix, len_greater, len_less, len_equal, len_not_equal, num_greater, num_less, num_equal, num_not_equal, exist, or not_exist.

contents

Array of strings

Content for the matching logic in the condition list.

  • If the matching logic is set to exist or not_exist, contents must be left blank. In other cases, contents is mandatory and cannot exceed 2,048 characters.

  • If the matching logic contains len, the value of contents must be an integer ranging from 0 to 65,535. If the match logic contains num, the value of contents must be an integer ranging from 0 to 512.

  • If category is set to method, the value of contents must contain 1 to 64 uppercase letters.

Table 6 WafCustomRuleAction

Parameter

Type

Description

category

String

Protection action.

block

pass

log

Example Requests

None

Example Responses

None

Status Codes

Status Code

Description

200

OK

Error Codes

See Error Codes.