获取域名列表¶
1. 接口描述¶
接口请求路径:POST /prod-api/cdn/domain/list
list 用于分页查询当前账号下的安全加速域名列表,支持按域名、端口、套餐、源站地址、备注及状态筛选。只返回当前登录账号且未删除的域名。
Token 获取方式见 密钥鉴权。
说明:
pageNum默认值:1。pageSize默认值:10。不传filters、searchHeader时查询全部。
2. 输入参数¶
以下请求参数列表仅列出了接口请求参数和部分公共参数,完整公共参数列表见 公共请求参数。
| 参数名称 | 必选 | 类型 | 描述 |
|---|---|---|---|
| pageNum | 否 | Integer | 当前页。默认值:1。示例值:1 |
| pageSize | 否 | Integer | 每页条数。默认值:10。示例值:10 |
| filters | 否 | [SearchFilter] | 搜索条件列表 |
| searchHeader | 否 | SearchHeader | 表头筛选 |
3. 输出参数¶
| 参数名称 | 类型 | 描述 |
|---|---|---|
| code | Integer | 状态码。示例值:200 |
| msg | String | 提示信息。示例值:成功 |
| total | Integer | 符合条件的总条数。示例值:1 |
| rows | [ResultDomainList] | 当前页域名列表 |
4. 示例¶
示例1 分页查询域名列表¶
输入示例¶
{
"filters": [
{
"label": "domainName",
"value": ["demotest.com"]
}
],
"searchHeader": {
"isActive": "0"
},
"pageSize": 10,
"pageNum": 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 DomainListTest {
public static void main(String[] args) throws Exception {
String url = "https://{登录域名}/prod-api/cdn/domain/list";
String token = "eyJhbGciOiJIUzUxMiJ9.xxxxxx";
String requestBody = "{"
+ "\"filters\":[{\"label\":\"domainName\",\"value\":[\"demotest.com\"]}],"
+ "\"searchHeader\":{\"isActive\":\"0\"},"
+ "\"pageSize\":10,"
+ "\"pageNum\":1"
+ "}";
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/cdn/domain/list"
token := "eyJhbGciOiJIUzUxMiJ9.xxxxxx"
requestBody := []byte(`{
"filters": [
{
"label": "domainName",
"value": ["demotest.com"]
}
],
"searchHeader": {
"isActive": "0"
},
"pageSize": 10,
"pageNum": 1
}`)
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": 219,
"sslsupport": "0",
"domainName": "demotest.com",
"ip": "1.1.1.1:21000",
"port": "21000",
"cNamePre": "demotest.com",
"cNameSuf": ".cdnwaf.net",
"doid": "202405232795134123456",
"isActive": "0",
"customerRemark": "",
"alias": "demo-alias",
"coreId": "215",
"waf": "0",
"stopTime": "0",
"updateTime": "1772010914",
"certEndTime": null,
"originProtocol": null,
"certStatus": null,
"certSource": null,
"isIntermediateSource": "off",
"origin": {
"httpOriginPort": 21000,
"httpsOriginPort": 21000,
"originGroupId": null,
"originType": "ipDomain",
"originRecord": "1.1.1.1",
"originProtocol": 0,
"records": null,
"originGroupName": null
}
}
],
"code": 200,
"msg": "成功"
}
5. 错误码¶
| HTTP 状态码 / 业务提示 | 描述 |
|---|---|
| 200 | 成功 |
| 401 | 未鉴权或 Token 无效 |
| 403 | 无权限 |
| 复杂查询条件不存在:[label] | filters.label 不在允许的搜索字段中 |
6. 数据模型¶
SearchFilter¶
搜索条件。value 仅 1 个元素时为模糊匹配;多个元素时为精确匹配(IN)。label 为 originRecord 时始终按 value 的第一个元素做模糊匹配,同时匹配源站地址与源站组记录。
| 参数名称 | 必选 | 类型 | 描述 |
|---|---|---|---|
| label | 是 | String | 搜索字段。取值:domainName(域名)、port(端口)、doid(套餐号)、ip(回源地址)、customerRemark(备注)、originRecord(源站地址)、originGroupId(源站组 ID)。示例值:domainName |
| value | 是 | Array of String | 搜索值。示例值:["demotest.com"] |
SearchHeader¶
表头筛选。字段均可省略;省略或空字符串表示不按该条件过滤。
| 参数名称 | 必选 | 类型 | 描述 |
|---|---|---|---|
| isActive | 否 | String | 域名状态。取值:0(配置中)、1(活跃)、2(暂停)、3(部署中)。示例值:0 |
| sslsupport | 否 | String | 是否配置证书。取值:0(未配置)、1(已配置)。示例值:0 |
| waf | 否 | String | WAF 标识。示例值:0 |
| orderTypes | 否 | Array of Integer | 所属套餐类型。取值:2(云 WAF)、3(DDoS 防御)、5(安全加速)。示例值:[5] |
ResultDomainList¶
域名列表项。
| 参数名称 | 类型 | 描述 |
|---|---|---|
| id | Long | 域名 ID。示例值:219 |
| sslsupport | String | 是否配置证书。取值:0(未配置)、1(已配置)。示例值:0 |
| domainName | String | 域名。示例值:demotest.com |
| ip | String | 回源地址,可能带端口。示例值:1.1.1.1:21000 |
| port | String | 访问端口。示例值:21000 |
| cNamePre | String | CNAME 前缀。示例值:demotest.com |
| cNameSuf | String | CNAME 后缀。示例值:.cdnwaf.net |
| doid | String | 所属套餐号。示例值:202405232795134123456 |
| isActive | String | 域名状态。取值:0(配置中)、1(活跃)、2(暂停)、3(部署中)。示例值:0 |
| customerRemark | String | 备注 |
| alias | String | 套餐别名。示例值:demo-alias |
| coreId | String | 核心 ID。示例值:215 |
| waf | String | WAF 标识。示例值:0 |
| stopTime | String | 停止时间。示例值:0 |
| updateTime | String | 更新时间(Unix 时间戳,秒)。示例值:1772010914 |
| certEndTime | String | 证书到期时间,格式 yyyy-MM-dd HH:mm:ss,可能为 null |
| originProtocol | Integer | 回源协议,可能为 null |
| certStatus | String | 证书状态,可能为 null |
| certSource | String | 证书来源,可能为 null |
| isIntermediateSource | String | 是否开启中间源。取值:on、off。示例值:off |
| origin | DomainOrigin | 源站配置,可能为 null |
DomainOrigin¶
源站配置。
| 参数名称 | 类型 | 描述 |
|---|---|---|
| httpOriginPort | Integer | HTTP 回源端口。示例值:21000 |
| httpsOriginPort | Integer | HTTPS 回源端口。示例值:21000 |
| originGroupId | Long | 源站组 ID。originType 为 originGroup 时返回 |
| originType | String | 源站类型。取值:ipDomain(IP)、originGroup(源站组)。示例值:ipDomain |
| originRecord | String | 源站地址。originType 为 ipDomain 时返回。示例值:1.1.1.1 |
| originProtocol | Integer | 回源协议。取值:0(HTTP)、1(协议跟随)、2(HTTPS)。示例值:0 |
| records | [DomainOriginRecord] | 源站组记录。originType 为 originGroup 时返回;否则可能为 null |
| originGroupName | String | 源站组名称。originType 为 originGroup 时返回;否则可能为 null |
DomainOriginRecord¶
源站组中的一条源站记录。
| 参数名称 | 类型 | 描述 |
|---|---|---|
| record | String | 源站地址。示例值:1.1.1.1 |
| weight | Integer | 权重。示例值:1 |