跳转至

列出证书

1. 接口描述

接口请求路径:POST /prod-api/acdn/tcdn/certificate/describeCertificate

describeCertificate 用于分页查询当前账号已导入的 TCDN 证书。账号需具备 tcdn:DescribeCertificate 或 tcdn:DescribeAllDomains 权限。

Token 获取方式见 密钥鉴权。

说明:只返回当前账号、未删除、且已关联 TCDN 的证书库记录。userId、direction 由服务端写入,调用方不要传递。控制台「证书列表」查的是已配置 HTTPS 的加速域名,请使用 查询域名证书列表。

2. 输入参数

以下请求参数列表仅列出了接口请求参数和部分公共参数,完整公共参数列表见 公共请求参数。

参数名称 必选 类型 描述
pageNum 否 Integer 当前页数。默认值:1。示例值:1
pageSize 否 Integer 每页显示条目个数。默认值:10。示例值:10
filters 否 Array 搜索条件。不筛选时传 []
filters.label 否 String 搜索字段。取值:subjectDN(证书主题)、dnsName(证书域名)。示例值:dnsName
filters.value 否 Array of String 搜索值。单个值为模糊搜索,多个值为精确搜索。示例值:["www.example.com"]

3. 输出参数

参数名称 类型 描述
code Integer 状态码。示例值:200
msg String 提示信息。示例值:成功
total Integer 证书总条数。示例值:1
rows Array 当前页证书列表
rows[].certId Long 平台证书 ID,删除和查询可关联域名时使用。示例值:91
rows[].source Integer 来源标识。通过 导入证书 导入时为 1。示例值:1
rows[].beginTime String 证书生效时间,格式 yyyy-MM-dd HH:mm:ss。示例值:2026-01-01 00:00:00
rows[].endTime String 证书到期时间,格式 yyyy-MM-dd HH:mm:ss。示例值:2027-01-01 00:00:00
rows[].subjectDN String 证书主题。示例值:www.example.com
rows[].issuerDN String 颁发者。示例值:Example CA
rows[].dnsName String 证书 SAN 域名,多个域名以英文逗号分隔。示例值:www.example.com,example.com
rows[].relatesId String 上游证书 ID。示例值:cert-example

4. 示例

示例1 分页查询证书

输入示例

{
  "pageNum": 1,
  "pageSize": 10,
  "filters": [
    {
      "label": "dnsName",
      "value": ["www.example.com"]
    }
  ]
}

代码调用

请将 {登录域名}、token 替换为实际值。

curl -X POST 'https://{登录域名}/prod-api/acdn/tcdn/certificate/describeCertificate' \
  -H 'Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.xxxxxx' \
  -H 'Content-Type: application/json' \
  -d '{
  "pageNum": 1,
  "pageSize": 10,
  "filters": [
    {
      "label": "dnsName",
      "value": ["www.example.com"]
    }
  ]
}'
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 DescribeCertificateTest {

    public static void main(String[] args) throws Exception {
        String url = "https://{登录域名}/prod-api/acdn/tcdn/certificate/describeCertificate";
        String token = "eyJhbGciOiJIUzUxMiJ9.xxxxxx";

        String requestBody = "{"
                + "\"pageNum\":1,"
                + "\"pageSize\":10,"
                + "\"filters\":[{\"label\":\"dnsName\",\"value\":[\"www.example.com\"]}]"
                + "}";

        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/certificate/describeCertificate"
    token := "eyJhbGciOiJIUzUxMiJ9.xxxxxx"

    requestBody := []byte(`{
  "pageNum": 1,
  "pageSize": 10,
  "filters": [
    {
      "label": "dnsName",
      "value": ["www.example.com"]
    }
  ]
}`)

    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": [
    {
      "certId": 91,
      "source": 1,
      "beginTime": "2026-01-01 00:00:00",
      "endTime": "2027-01-01 00:00:00",
      "subjectDN": "www.example.com",
      "issuerDN": "Example CA",
      "dnsName": "www.example.com,example.com",
      "relatesId": "cert-example"
    }
  ]
}

5. 错误码

HTTP 状态码 / 业务提示 描述
200 成功
401 未鉴权或 Token 无效
403 无权限,需具备 tcdn:DescribeCertificate 或 tcdn:DescribeAllDomains
复杂查询条件不存在:[{0}] filters.label 不是 subjectDN 或 dnsName。{0} 为传入的字段名