跳转至

列出域名的防篡改规则

1. 接口描述

接口请求路径:POST /prod-api/waf/wafv3/falsify/describeFalsifyByDomain

describeFalsifyByDomain 用于分页查询指定域名下已配置的防篡改路径规则(受保护页面全路径)。domainId 来自 列出防篡改域名 返回的 rows[].domainId

Token 获取方式见 密钥鉴权

2. 输入参数

以下请求参数列表仅列出了接口请求参数和部分公共参数,完整公共参数列表见 公共请求参数

参数名称 必选 类型 描述
domainId Long 域名 ID
示例值:215
pageNum Integer 当前页数
示例值:1
pageSize Integer 每页显示条目个数
示例值:10

3. 示例

示例1 分页查询域名防篡改规则

输入示例

{
  "pageNum": 1,
  "pageSize": 10,
  "domainId": 215
}

代码调用

请将 {登录域名}token 替换为实际值。

import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;

public class DescribeFalsifyByDomainTest {

    public static void main(String[] args) throws Exception {
        String url = "https://{登录域名}/prod-api/waf/wafv3/falsify/describeFalsifyByDomain";
        String token = "eyJhbGciOiJIUzUxMiJ9.xxxxxx";

        String requestBody = "{"
                + "\"pageNum\":1,"
                + "\"pageSize\":10,"
                + "\"domainId\":215"
                + "}";

        try (CloseableHttpClient httpClient = HttpClients.createDefault()) {
            HttpPost httpPost = new HttpPost(url);
            httpPost.setHeader("Authorization", "Bearer " + token);
            httpPost.setEntity(new StringEntity(requestBody, ContentType.APPLICATION_JSON));

            try (CloseableHttpResponse response = httpClient.execute(httpPost)) {
                int statusCode = response.getStatusLine().getStatusCode();
                String body = EntityUtils.toString(response.getEntity(), "UTF-8");
                System.out.println("Status Code: " + statusCode);
                System.out.println("Body: " + body);
            }
        }
    }
}
package main

import (
    "bytes"
    "fmt"
    "io"
    "net/http"
)

func main() {
    url := "https://{登录域名}/prod-api/waf/wafv3/falsify/describeFalsifyByDomain"
    token := "eyJhbGciOiJIUzUxMiJ9.xxxxxx"

    requestBody := []byte(`{
  "pageNum": 1,
  "pageSize": 10,
  "domainId": 215
}`)

    req, err := http.NewRequest(http.MethodPost, url, bytes.NewReader(requestBody))
    if err != nil {
        panic(err)
    }
    req.Header.Set("Authorization", "Bearer "+token)
    req.Header.Set("Content-Type", "application/json")

    resp, err := http.DefaultClient.Do(req)
    if err != nil {
        panic(err)
    }
    defer resp.Body.Close()

    body, err := io.ReadAll(resp.Body)
    if err != nil {
        panic(err)
    }
    fmt.Println("Status Code:", resp.StatusCode)
    fmt.Println("Body:", string(body))
}

输出示例

{
  "total": 1,
  "rows": [
    {
      "locationId": 2680,
      "name": "/root/index.jsp",
      "type": "4",
      "json": null,
      "sort": 999
    }
  ],
  "code": 200,
  "msg": "成功"
}

4. 输出参数

参数名称 类型 描述
code Integer 状态码。示例值:200
msg String 提示信息。示例值:成功
total Integer 该域名下防篡改规则总数。示例值:1
rows Array 规则列表
rows[].locationId Long 规则/路径 ID;编辑、删除、刷新缓存时作为 falsifyRuleId 传入。示例值:2680
rows[].name String 受保护页面全路径,需以 / 开头。示例值:/root/index.jsp
rows[].type String 规则类型;防篡改固定为 "4"。示例值:4
rows[].json String 扩展配置;防篡改规则一般为 null
rows[].sort Integer 排序权重。示例值:999

5. 错误码

HTTP 状态码 / 业务提示 描述
200 成功
401 未鉴权或 Token 无效
403 无权限
domainId不能为空 未传 domainId