查询域名列表¶
1. 接口描述¶
接口请求路径:POST /prod-api/waf/wafv3/domains/describeDomainList
describeDomainList 用于分页查询指定 WAF 套餐下已接入的域名资源列表,返回域名基础信息、CNAME、证书与策略组关联状态,并提供批量关联策略时所需的域名 ID(id)。
Token 获取方式见 密钥鉴权。
2. 输入参数¶
以下请求参数列表仅列出了接口请求参数和部分公共参数,完整公共参数列表见 公共请求参数。
| 参数名称 | 必选 | 类型 | 描述 |
|---|---|---|---|
| pageNum | 是 | Integer | 当前页数。示例值:1 |
| pageSize | 是 | Integer | 每页显示条目个数。示例值:10 |
| oid | 是 | String | WAF 套餐/订单 ID。示例值:20240412279097884616 |
| filters | 否 | [SearchFilter] | 搜索条件列表;不筛选时传 [] |
| searchHeader | 否 | DomainSearchHeader | 表头/状态筛选;无筛选时传 {} |
3. 输出参数¶
| 参数名称 | 类型 | 描述 |
|---|---|---|
| code | Integer | 状态码。示例值:200 |
| msg | String | 提示信息。示例值:成功 |
| total | Integer | 符合条件的总条数。示例值:1 |
| rows | [WafDomain] | 域名列表 |
4. 示例¶
示例1 分页查询域名列表¶
输入示例¶
代码调用¶
请将 {登录域名}、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 DescribeDomainListTest {
public static void main(String[] args) throws Exception {
String url = "https://{登录域名}/prod-api/waf/wafv3/domains/describeDomainList";
String token = "eyJhbGciOiJIUzUxMiJ9.xxxxxx";
String requestBody = "{"
+ "\"pageNum\":1,"
+ "\"pageSize\":10,"
+ "\"oid\":\"20240412279097884616\","
+ "\"filters\":[],"
+ "\"searchHeader\":{}"
+ "}";
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/domains/describeDomainList"
token := "eyJhbGciOiJIUzUxMiJ9.xxxxxx"
requestBody := []byte(`{
"pageNum": 1,
"pageSize": 10,
"oid": "20240412279097884616",
"filters": [],
"searchHeader": {}
}`)
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": [
{
"id": 657,
"sslsupport": "0",
"domainName": "*.testpctl.hk",
"ip": "1.1.1.1",
"port": "0",
"cNamePre": "alldomainurl.testpctl.hk",
"cNameSuf": ".example.cn",
"doid": "20240412279097884616",
"isActive": "1",
"customerRemark": "",
"alias": "c8f24509cb564acfbad2fbfa2eac4d",
"stopTime": "0",
"updateTime": "1778730016",
"certEndTime": null,
"wafAclName": null,
"wafAclId": null,
"wafAclStatus": null
}
],
"code": 200,
"msg": "成功"
}
5. 错误码¶
| HTTP 状态码 / 业务提示 | 描述 |
|---|---|
| 200 | 成功 |
| 401 | 未鉴权或 Token 无效 |
| 403 | 无权限 |
| 套餐ID不能为空 | 未传 oid |
| 复杂查询条件不存在:[{label}] | filters.label 不在允许列表中 |
6. 数据模型¶
SearchFilter¶
列表筛选条件。
| 参数名称 | 必选 | 类型 | 描述 |
|---|---|---|---|
| label | 是 | String | 搜索字段。取值:domainName(域名)、port(监听端口)、doid(套餐/订单 ID)、ip(回源 IP)、customerRemark(备注)、originRecord(回源记录)、originGroupId(源站组 ID)。示例值:domainName |
| value | 是 | Array of String | 搜索值。单值时多为模糊匹配。示例值:["*.testpctl.hk"] |
DomainSearchHeader¶
表头筛选条件。
| 参数名称 | 必选 | 类型 | 描述 |
|---|---|---|---|
| isActive | 否 | String | 域名状态筛选。取值:0(配置中)、1(活跃/部署中)、2(暂停)。示例值:1 |
| sslsupport | 否 | String | 是否 HTTPS 筛选。取值:0(否)、1(是) |
| waf | 否 | String | WAF 接入标记筛选 |
WafDomain¶
套餐下域名资源项。
| 参数名称 | 类型 | 描述 |
|---|---|---|
| id | Long | 域名 ID;关联策略时作为 domainIds 传入。示例值:657 |
| domainName | String | 域名。示例值:*.testpctl.hk |
| port | String | 监听端口;"0" 通常表示默认端口。示例值:0 |
| ip | String | 回源地址,多行时以换行分隔。示例值:1.1.1.1 |
| sslsupport | String | 是否 HTTPS。取值:0(否)、1(是)。示例值:0 |
| cNamePre | String | CNAME 前缀。示例值:alldomainurl.testpctl.hk |
| cNameSuf | String | CNAME 后缀;完整 CNAME 一般为 cNamePre + cNameSuf |
| doid | String | 所属套餐/订单 ID,与请求 oid 一致。示例值:20240412279097884616 |
| isActive | String | 域名状态。取值:0(配置中)、1(活跃/部署中)、2(暂停)。示例值:1 |
| customerRemark | String | 备注 |
| alias | String | 订单别名标识 |
| updateTime | String | 最近更新时间(Unix 时间戳,秒)。示例值:1778730016 |
| stopTime | String | 停用相关时间戳。示例值:0 |
| certEndTime | String | 证书到期时间;可能为 null |
| wafAclId | Long | 已关联的 WAF 策略组 ID;null 表示未关联 |
| wafAclName | String | 已关联的策略组名称;未关联时为 null |
| wafAclStatus | String | 策略组状态;未关联时为 null |