删除 IP 获取规则集合¶
1. 接口描述¶
接口请求路径:POST /prod-api/waf/realIP/deleteRealIPRules
deleteRealIPRules 用于按规则集 ID 批量删除真实 IP 获取规则集合,并解除与域名的关联。
Token 获取方式见 密钥鉴权。
2. 输入参数¶
以下请求参数列表仅列出了接口请求参数和部分公共参数,完整公共参数列表见 公共请求参数。
| 参数名称 | 必选 | 类型 | 描述 |
|---|---|---|---|
| ids | 是 | Array of Long | 待删除的规则集 ID 列表 示例值: [23] |
3. 示例¶
示例1 删除 IP 获取规则集合¶
输入示例¶
代码调用¶
请将 {登录域名}、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 DeleteRealIPRulesTest {
public static void main(String[] args) throws Exception {
String url = "https://{登录域名}/prod-api/waf/realIP/deleteRealIPRules";
String token = "eyJhbGciOiJIUzUxMiJ9.xxxxxx";
String requestBody = "{\"ids\":[23]}";
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/realIP/deleteRealIPRules"
token := "eyJhbGciOiJIUzUxMiJ9.xxxxxx"
requestBody := []byte(`{
"ids": [23]
}`)
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))
}
输出示例¶
{
"msg": "成功",
"code": 200,
"data": [
{
"ruleId": 23,
"ruleName": "text",
"message": "success"
}
]
}
4. 输出参数¶
| 参数名称 | 类型 | 描述 |
|---|---|---|
| code | Integer | 状态码。示例值:200 |
| msg | String | 提示信息。示例值:成功 |
| data | Array | 删除结果列表 |
| data[].ruleId | Long | 规则集 ID。示例值:23 |
| data[].ruleName | String | 规则名称;规则不存在时可能为空。示例值:text |
| data[].message | String | 处理结果。默认 success;规则不存在时为 规则不存在。可能已被删除示例值: success |
5. 错误码¶
| HTTP 状态码 / 业务提示 | 描述 |
|---|---|
| 200 | 成功 |
| 401 | 未鉴权或 Token 无效 |
| 403 | 无权限 |
| ids不能为空 | 未传 ids 或为 null |