跳转至

查询自定义证书列表

1. 接口描述

接口请求路径:POST /prod-api/acdn/ccdn/certificateRest/describeCustomCertificates

describeCustomCertificates 用于分页查询指定主域名下已上传的自定义 SSL 证书。账号需具备 ccdn:domain:query 权限。

Token 获取方式见 密钥鉴权。

注意:zoneId 必须为当前账号下的域名,取自 查询域名列表 返回的 rows[].zoneId。

2. 输入参数

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

参数名称 必选 类型 描述
zoneId 是 String 域名 Zone ID。示例值:551290393816e70c5e9765ca020e30a4
pageNum 是 Integer 当前页。示例值:1
pageSize 是 Integer 每页条数。示例值:10
match 否 String 搜索关键字,按主机匹配。示例值:example.com
status 否 String 证书状态筛选。取值:active 有效、expired 到期、deleted 删除、pending 待定、initializing 初始化

3. 输出参数

data 为上游返回的分页结果。

参数名称 类型 描述
code Integer 状态码。示例值:200
msg String 提示信息。示例值:成功
data Object 上游分页结果
data.success Boolean 上游调用是否成功。示例值:true
data.result Array 当前页证书列表
data.result[].id String 证书 ID,编辑、查询详情、删除时使用。示例值:8b0d6d0c72c14b21a7e39d4f5b1a2c3e
data.result[].hosts Array of String 主机,证书生效的主机名列表。示例值:["example.com", "*.example.com"]
data.result[].issuer String 证书签发机构。示例值:Let's Encrypt
data.result[].signature String 签名算法。示例值:SHA256WithRSA
data.result[].status String 状态。取值:active 有效、expired 到期、deleted 删除、pending 待定、initializing 初始化
data.result[].bundle_method String 类型(捆绑方法)。取值:ubiquitous 兼容(推荐)、optimal 现代、force 用户定义
data.result[].type String 旧客户端支持。取值:legacy_custom 新版(推荐)、sni_custom 旧版
data.result[].zone_id String 域名 Zone ID
data.result[].uploaded_on String 上传时间(UTC)。示例值:2025-09-03T14:34:46.000000Z
data.result[].modified_on String 更新时间(UTC)。示例值:2025-09-03T14:34:46.000000Z
data.result[].expires_on String 到期时间(UTC)。示例值:2026-09-03T14:34:46.000000Z
data.result[].priority Integer 证书优先级。示例值:0
data.result_info Object 分页信息
data.result_info.page Integer 当前页。示例值:1
data.result_info.per_page Integer 每页条数。示例值:10
data.result_info.count Integer 当前页条数。示例值:1
data.result_info.total_count Integer 证书总条数。示例值:1

4. 示例

示例1 分页查询自定义证书

输入示例

{
  "zoneId": "551290393816e70c5e9765ca020e30a4",
  "pageNum": 1,
  "pageSize": 10,
  "status": "active"
}

代码调用

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

curl -X POST 'https://{登录域名}/prod-api/acdn/ccdn/certificateRest/describeCustomCertificates' \
  -H 'Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.xxxxxx' \
  -H 'Content-Type: application/json' \
  -d '{
  "zoneId": "551290393816e70c5e9765ca020e30a4",
  "pageNum": 1,
  "pageSize": 10,
  "status": "active"
}'
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 DescribeCustomCertificatesTest {

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

        String requestBody = "{"
                + "\"zoneId\":\"551290393816e70c5e9765ca020e30a4\","
                + "\"pageNum\":1,"
                + "\"pageSize\":10,"
                + "\"status\":\"active\""
                + "}";

        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/ccdn/certificateRest/describeCustomCertificates"
    token := "eyJhbGciOiJIUzUxMiJ9.xxxxxx"

    requestBody := []byte(`{
  "zoneId": "551290393816e70c5e9765ca020e30a4",
  "pageNum": 1,
  "pageSize": 10,
  "status": "active"
}`)

    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,
  "data": {
    "success": true,
    "errors": [],
    "messages": [],
    "result": [
      {
        "id": "8b0d6d0c72c14b21a7e39d4f5b1a2c3e",
        "hosts": ["example.com", "*.example.com"],
        "issuer": "Let's Encrypt",
        "signature": "SHA256WithRSA",
        "status": "active",
        "bundle_method": "ubiquitous",
        "type": "legacy_custom",
        "zone_id": "551290393816e70c5e9765ca020e30a4",
        "uploaded_on": "2025-09-03T14:34:46.000000Z",
        "modified_on": "2025-09-03T14:34:46.000000Z",
        "expires_on": "2026-09-03T14:34:46.000000Z",
        "priority": 0
      }
    ],
    "result_info": {
      "page": 1,
      "per_page": 10,
      "count": 1,
      "total_count": 1
    }
  }
}

5. 错误码

查询失败时,code 为 500,原因在 msg,没有 data。

HTTP 状态码 / 业务提示 描述
200 成功
401 未鉴权或 Token 无效
403 无权限,需具备 ccdn:domain:query
请输入分页参数 未传入 pageNum 或 pageSize
无效的zoneId zoneId 不存在或不属于当前账号