查询精准防护规则列表
功能介绍
查询精准防护规则列表
URI
GET /v1/{project_id}/waf/policy/{policy_id}/custom
|
参数 |
是否必选 |
参数类型 |
描述 |
|---|---|---|---|
|
project_id |
是 |
String |
用户操作的项目id |
|
policy_id |
是 |
String |
防护策略id,您可以通过调用查询防护策略列表(ListPolicy)获取策略id |
|
参数 |
是否必选 |
参数类型 |
描述 |
|---|---|---|---|
|
page |
否 |
Integer |
分页查询时,返回第几页数据。范围0-100000,默认值为1,表示返回第1页数据。 缺省值:1 |
|
pagesize |
否 |
Integer |
分页查询时,每页包含多少条结果。范围1-100,默认值为10,表示每页包含10条结果。 缺省值:10 |
请求参数
|
参数 |
是否必选 |
参数类型 |
描述 |
|---|---|---|---|
|
X-Auth-Token |
是 |
String |
auth token |
|
Content-Type |
是 |
String |
内容类型 缺省值:application/json;charset=utf8 |
响应参数
状态码: 200
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
total |
Integer |
该策略下设置的精准防护规则总数量 |
|
items |
Array of objects |
精准防护规则的对象列表 |
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
id |
String |
精准防护规则的id |
|
policyid |
String |
精准防护规则的策略id |
|
conditions |
Array of conditions objects |
匹配条件列表,匹配条件必须同时满足。 |
|
action |
action object |
精准防护规则命中后操作对象 |
|
priority |
Integer |
执行该规则的优先级,值越小,优先级越高,值相同时,规则创建时间早,优先级越高。取值范围:0到1000。 |
|
timestamp |
Long |
创建精准防护规则的 |
|
start |
Long |
精准防护规则生效的起始时间戳(毫秒)。当time=true,才会返回该参数。 |
|
terminal |
Long |
精准防护规则生效的终止时间戳(毫秒)。当time=true,才会返回该参数。 |
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
category |
String |
字段类型。固定值path、user-agent、ip、params、cookie、referer、header。 |
|
index |
String |
该参数的含义为:
|
|
check_all_indexes_logic |
Integer |
使用自定义子字段、字段类型为url或ip时不需要传check_all_indexes_logic参数,其它情况需要传该参数:
|
|
logic_operation |
Integer |
条件匹配逻辑,“contain”,“not_contain”,“equal”,“not_equal”,“prefix”,“not_prefix”,“suffix”,“not_suffix”分别代表包含、不包含、等于、不等于、前缀为、前缀不为、后缀为、后缀不为。当条件类型“category”为ip时,“logic_operation”只能为“equal”或者“not_equal” |
|
contents |
Array of strings |
条件匹配的内容 |
状态码: 400
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
error_code |
String |
错误码 |
|
error_msg |
String |
错误信息 |
状态码: 401
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
error_code |
String |
错误码 |
|
error_msg |
String |
错误信息 |
状态码: 500
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
error_code |
String |
错误码 |
|
error_msg |
String |
错误信息 |
请求示例
GET https://{Endpoint}/v1/{project_id}/waf/policy/{policy_id}/custom?enterprise_project_id=0
响应示例
状态码: 200
ok
{
"items" : [ {
"category" : "block",
"action_mode" : false,
"aging_time" : 0,
"conditions" : [ {
"category" : "header",
"index" : "sdfsafsda",
"logic_operation" : "exist"
} ],
"description" : "",
"id" : "2a3caa2bc9814c09ad73d02e3485b4a4",
"policyid" : "1f016cde588646aca3fb19f277c44d03",
"priority" : 50,
"producer" : 1,
"status" : 1,
"time" : false,
"timestamp" : 1656495488880
} ],
"total" : 1
}
状态码
|
状态码 |
描述 |
|---|---|
|
200 |
ok |
|
400 |
请求失败 |
|
401 |
token权限不足 |
|
500 |
服务器内部错误 |
错误码
请参见错误码。