查询域名证书列表¶
1. 接口描述¶
接口请求路径:POST /prod-api/acdn/tcdn/domainRest/describeDomainsConfig
本页对应控制台证书列表。它不是 列出证书。describeDomainsConfig 在 filters 中按 HTTPS 状态筛选后,返回已接入域名及其证书配置。账号需具备 tcdn:DescribeAllDomains 权限。
Token 获取方式见 密钥鉴权。
说明: - 域名上的其余配置字段见 查询域名详细配置。关闭该域名 HTTPS 请调用 更新域名配置,将
https.switch设为off,不要调用 删除证书。
2. 输入参数¶
以下请求参数列表仅列出了接口请求参数和部分公共参数,完整公共参数列表见 公共请求参数。
| 参数名称 | 必选 | 类型 | 描述 |
|---|---|---|---|
| pageNum | 是 | Integer | 当前页。示例值:1 |
| pageSize | 是 | Integer | 每页条数。示例值:10 |
| filters | 否 | Array | 搜索条件。证书列表至少包含一条 https 条件 |
| filters.label | 是 | String | 搜索字段。取值:domain(加速域名) |
| filters.value | 是 | Array of String | 搜索值 |
3. 输出参数¶
成功时结果在 rows,没有 data。下表只列证书列表用到的字段。
| 参数名称 | 类型 | 描述 |
|---|---|---|
| code | Integer | 状态码。示例值:200 |
| msg | String | 提示信息。示例值:成功 |
| total | Integer | 命中域名总条数。示例值:1 |
| rows | Array | 当前页域名配置 |
| rows[].domain | String | 加速域名。示例值:www.example.com |
| rows[].resourceId | String | 资源 ID,更新该域名证书时使用。示例值:cdn-example |
| rows[].serviceType | String | 业务类型。取值:web(网页小文件)、download(下载大文件)、media(音视频点播)、hybrid(动静加速)、dynamic(动态加速)。示例值:web |
| rows[].updateTime | String | 配置更新时间。示例值:2026-10-29 14:00:00 |
| rows[].https | Object | HTTPS 配置。字段见 Https |
| rows[].https.switch | String | HTTPS 开关。取值:on、off。示例值:on |
| rows[].https.sslStatus | String | 证书部署状态。取值:closed(已关闭)、deploying(部署中)、deployed(配置成功)、failed(配置失败)。示例值:deployed |
| rows[].https.certInfo | Object | 当前证书,未配置时可能为 null。字段见 ServerCert |
| rows[].https.certInfo.certId | String | 托管证书 ID,对应 导入证书 返回的 data.relatesId。示例值:cert-example |
| rows[].https.certInfo.from | String | 证书来源。上传托管证书为 upload。示例值:upload |
| rows[].https.certInfo.expireTime | String | 证书过期时间。示例值:2027-01-01 00:00:00 |
4. 示例¶
示例1 查询已配置 HTTPS 的域名¶
输入示例¶
代码调用¶
请将 {登录域名}、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 DescribeDomainCertificateTest {
public static void main(String[] args) throws Exception {
String url = "https://{登录域名}/prod-api/acdn/tcdn/domainRest/describeDomainsConfig";
String token = "eyJhbGciOiJIUzUxMiJ9.xxxxxx";
String requestBody = "{"
+ "\"pageNum\":1,"
+ "\"pageSize\":10,"
+ "\"filters\":[{\"label\":\"https\",\"value\":[\"on\"]}]"
+ "}";
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/acdn/tcdn/domainRest/describeDomainsConfig"
token := "eyJhbGciOiJIUzUxMiJ9.xxxxxx"
requestBody := []byte(`{
"pageNum": 1,
"pageSize": 10,
"filters": [
{
"label": "https",
"value": ["on"]
}
]
}`)
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,
"total": 1,
"rows": [
{
"domain": "www.example.com",
"resourceId": "cdn-example",
"serviceType": "web",
"updateTime": "2026-10-29 14:00:00",
"https": {
"switch": "on",
"sslStatus": "deployed",
"certInfo": {
"certId": "cert-example",
"from": "upload",
"expireTime": "2027-01-01 00:00:00"
}
}
}
]
}
5. 错误码¶
上游或配置失败时,code 为 500,原因在 msg。
| HTTP 状态码 / 业务提示 | 描述 |
|---|---|
| 200 | 成功 |
| 401 | 未鉴权或 Token 无效 |
| 403 | 无权限,需具备 tcdn:DescribeAllDomains |
| 参数不能为空 | 未传请求体 |
| 分页参数不能为空 | 未传 pageNum 或 pageSize |
| 未初始化TCDN配置,请先联系管理员 | 当前账号未配置 TCDN |
| 未初始化TCDN配置(apiKeyId),请先联系管理员 | 未配置 API 密钥 |
| 未初始化TCDN配置(project),请先联系管理员 | 未配置项目 |
| 未查询到对应的API密钥信息 | 密钥配置不存在 |
| error code:{0},message:{1} | 上游查询失败。{0} 为错误码,{1} 为原因 |