获取域名列表¶
1. 接口描述¶
接口请求路径:POST /prod-api/cdn/domain/list
list 用于分页查询当前账号下的安全加速域名列表,支持按域名、端口、套餐、源站地址、备注及状态筛选。
Token 获取方式见 密钥鉴权。
2. 输入参数¶
以下请求参数列表仅列出了接口请求参数和部分公共参数,完整公共参数列表见 公共请求参数。
| 参数名称 | 必选 | 类型 | 描述 |
|---|---|---|---|
| pageNum | 是 | Integer | 当前页数 示例值: 1 |
| pageSize | 是 | Integer | 每页显示条目个数 示例值: 10 |
| filters | 否 | Array | 搜索条件列表 |
| filters.label | 否 | String | 搜索字段。取值:domainName(域名)、port(端口)、doid(套餐)、originRecord(源站地址)、customerRemark(备注)示例值: domainName |
| filters.value | 否 | Array of String | 搜索值。传入单个值为模糊搜索,多个值为精确搜索 示例值: ["demo.com.cn"] |
| searchHeader | 是 | Object | 筛选条件 |
| searchHeader.isActive | 是 | String | 域名状态。取值:0(配置中)、1(活跃/部署中)、2(暂停)示例值: 0 |
3. 示例¶
示例1 分页查询域名列表¶
输入示例¶
{
"filters": [
{
"label": "domainName",
"value": ["demo.com.cn"]
}
],
"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\":[\"demo.com.cn\"]}],"
+ "\"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": ["demo.com.cn"]
}
],
"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": "gbp.gloria.com.cn",
"ip": "1.1.1.1:21000",
"port": "21000",
"cNamePre": "gbp.gloria.com.cn",
"cNameSuf": ".cdnwaf.net",
"doid": "20240412279097884616",
"isActive": "0",
"customerRemark": "",
"alias": "c8f24509cb564acfbad2fbfa2eac4d",
"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": "成功"
}
4. 输出参数¶
| 参数名称 | 类型 | 描述 |
|---|---|---|
| code | Integer | 状态码。示例值:200 |
| msg | String | 提示信息。示例值:成功 |
| total | Integer | 域名总条数。示例值:1 |
| rows | Array | 当前页域名列表 |
| rows[].id | Integer | 域名 ID。示例值:219 |
| rows[].sslsupport | String | 是否配置证书。1 表示已配置证书。示例值:0 |
| rows[].domainName | String | 域名。示例值:gbp.gloria.com.cn |
| rows[].ip | String | 回源地址。示例值:1.1.1.1:21000 |
| rows[].port | String | 端口。示例值:21000 |
| rows[].cNamePre | String | CNAME 前缀。示例值:gbp.gloria.com.cn |
| rows[].cNameSuf | String | CNAME 后缀。示例值:.cdnwaf.net |
| rows[].doid | String | 所属套餐号。示例值:20240412279097884616 |
| rows[].isActive | String | 域名状态。取值:0(配置中)、1(活跃/部署中)、2(暂停)。示例值:0 |
| rows[].customerRemark | String | 备注 |
| rows[].alias | String | 别名。示例值:c8f24509cb564acfbad2fbfa2eac4d |
| rows[].coreId | String | 核心 ID。示例值:215 |
| rows[].waf | String | WAF 标识。示例值:0 |
| rows[].stopTime | String | 结束时间。示例值:0 |
| rows[].updateTime | String | 更新时间(Unix 时间戳)。示例值:1772010914 |
| rows[].certEndTime | String | 证书到期时间,可能为 null |
| rows[].originProtocol | Integer | 源协议,可能为 null |
| rows[].certStatus | String | 证书状态,可能为 null |
| rows[].certSource | String | 证书来源,可能为 null |
| rows[].isIntermediateSource | String | 是否开启中间源。取值:on、off。示例值:off |
| rows[].origin | Object | 源站配置 |
| rows[].origin.httpOriginPort | Integer | HTTP 回源端口。示例值:21000 |
| rows[].origin.httpsOriginPort | Integer | HTTPS 回源端口。示例值:21000 |
| rows[].origin.originGroupId | String | 源站组 ID。originType 为 originGroup 时返回 |
| rows[].origin.originType | String | 源站类型。取值:ipDomain(IP/域名)、originGroup(源站组)。示例值:ipDomain |
| rows[].origin.originRecord | String | 源站地址。originType 为 ipDomain 时返回。示例值:1.1.1.1 |
| rows[].origin.originProtocol | Integer | 源协议。取值:0(HTTP)、1(协议跟随)、2(HTTPS)。示例值:0 |
| rows[].origin.records | Array | 源记录,可能为 null |
| rows[].origin.originGroupName | String | 源站组名称,可能为 null |
5. 错误码¶
| HTTP 状态码 / 业务提示 | 描述 |
|---|---|
| 200 | 成功 |
| 401 | 未鉴权或 Token 无效 |
| 403 | 无权限 |