查询域名列表¶
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;为空时报错「套餐ID不能为空」 示例值: 20240412279097884616 |
| filters | 否 | Array | 搜索条件列表;不筛选时传 [] |
| filters.label | 否 | String | 搜索字段,支持以下值:domainName:域名port:监听端口doid:套餐/订单 IDip:回源 IPcustomerRemark:备注示例值: domainName |
| filters.value | 否 | Array of String | 搜索值。单值时多为模糊匹配 示例值: ["*.testpctl.hk"] |
| searchHeader | 否 | Object | 表头/状态筛选;无筛选时传 {} |
| searchHeader.isActive | 否 | String | 域名状态筛选,支持以下值:0:配置中1:活跃/部署中2:暂停示例值: 1 |
3. 示例¶
示例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": ".ruisuyun.cn",
"doid": "20240412279097884616",
"isActive": "1",
"customerRemark": "",
"alias": "c8f24509cb564acfbad2fbfa2eac4d",
"coreId": null,
"waf": null,
"stopTime": "0",
"updateTime": "1778730016",
"certEndTime": null,
"originProtocol": null,
"certStatus": null,
"certSource": null,
"isIntermediateSource": null,
"origin": null,
"wafAclName": null,
"wafAclId": null,
"wafAclStatus": null
}
],
"code": 200,
"msg": "成功"
}
4. 输出参数¶
| 参数名称 | 类型 | 描述 |
|---|---|---|
| code | Integer | 状态码。示例值:200 |
| msg | String | 提示信息。示例值:成功 |
| total | Integer | 符合条件的总条数。示例值:1 |
| rows | Array | 域名列表 |
| rows[].id | Long | 域名 ID;关联策略时作为 domainIds 传入。示例值:657 |
| rows[].domainName | String | 域名。示例值:*.testpctl.hk |
| rows[].port | String | 监听端口;"0" 通常表示默认端口。示例值:0 |
| rows[].ip | String | 回源地址,多行时以换行分隔。示例值:1.1.1.1 |
| rows[].sslsupport | String | 是否 HTTPS,支持以下值:0:否1:是示例值: 0 |
| rows[].cNamePre | String | CNAME 前缀。示例值:alldomainurl.testpctl.hk |
| rows[].cNameSuf | String | CNAME 后缀;完整 CNAME 一般为 cNamePre + cNameSuf。示例值:.ruisuyun.cn |
| rows[].doid | String | 所属套餐/订单 ID,与请求 oid 一致。示例值:20240412279097884616 |
| rows[].isActive | String | 域名状态,支持以下值:0:配置中1:活跃/部署中2:暂停示例值: 1 |
| rows[].customerRemark | String | 备注 |
| rows[].alias | String | 订单别名标识。示例值:c8f24509cb564acfbad2fbfa2eac4d |
| rows[].updateTime | String | 最近更新时间(Unix 时间戳,秒)。示例值:1778730016 |
| rows[].stopTime | String | 停用相关时间戳。示例值:0 |
| rows[].wafAclId | Long | 已关联的 WAF 策略组 ID;null 表示未关联 |
| rows[].wafAclName | String | 已关联的策略组名称;未关联时为 null |
| rows[].wafAclStatus | String | 策略组状态;未关联时为 null |
| rows[].waf | String | WAF 核心接入标记;可能为 null |
| rows[].coreId | String | WAF 核心记录 ID;可能为 null |
| rows[].certEndTime | String | 证书到期时间;可能为 null |
| rows[].certStatus | String | 证书状态;可能为 null |
| rows[].certSource | String | 证书来源;可能为 null |
| rows[].originProtocol | Integer | 回源协议;可能为 null |
| rows[].isIntermediateSource | String | 中间源开关;可能为 null |
| rows[].origin | Object | 回源配置详情;可能为 null |
5. 错误码¶
| HTTP 状态码 / 业务提示 | 描述 |
|---|---|
| 200 | 成功 |
| 401 | 未鉴权或 Token 无效 |
| 403 | 无权限 |
| 套餐ID不能为空 | 未传 oid |