Updated on 2026-09-10 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.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.

  • If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
  • If you are using identity policy-based authorization, no identity policy-based permission required for calling this API.

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 ListWafCustomRule objects

Data item

Table 4 ListWafCustomRule

Parameter

Type

Description

id

String

id

name

String

name

time

Boolean

Time the precise protection rule takes effect.

  • true: The rule takes effect at a customized time.

  • false: The rule takes effect immediately.

timestamp

Long

Time when a precise protection rule is created.

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

Table 5 WafCustomCondition

Parameter

Type

Description

category

String

Field type. The options are as follows:

  • 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 is mandatory. Its value must be client-ip for client IP addresses,** x-forwarded-for** for X-Forwarded-For, or ** $remote_addr** for TCP connection IP addresses.

  • 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.

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: log only.

Example Requests

Query the Chinese mainland precise protection rule whose domain name is test.com.

GET https://{endpoint}/v2/aad/policies/waf/custom-rule?domain_name=test.com&overseas_type=0

Example Responses

Status code: 200

{
  "total" : 1,
  "items" : [ {
    "id" : "f2a59811-7073-xxx-xxx-xxx",
    "name" : "test",
    "time" : false,
    "priority" : 10,
    "conditions" : [ {
      "category" : "cookie",
      "index" : "123123",
      "contents" : [ "231231" ],
      "logic_operation" : "contain"
    } ],
    "action" : {
      "category" : "block"
    }
  } ]
}

Status Codes

Status Code

Description

200

OK

Error Codes

See Error Codes.