跳转至

查询自定义证书详情

1. 接口描述

接口请求路径:GET /prod-api/acdn/ccdn/certificateRest/describeCustomCertificate

describeCustomCertificate 用于查询指定自定义 SSL 证书的详情,返回内容包含证书 PEM 原文。账号需具备 ccdn:domain:edit 权限。

Token 获取方式见 密钥鉴权。

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

2. 输入参数

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

参数以 Query 方式传递。

参数名称 必选 类型 描述
zoneId 是 String 域名 Zone ID。示例值:551290393816e70c5e9765ca020e30a4
customCertificateId 是 String 证书 ID,取自 查询自定义证书列表 返回的 data.result[].id。示例值:8b0d6d0c72c14b21a7e39d4f5b1a2c3e

3. 输出参数

data 为上游返回的证书详情对象,字段同 查询自定义证书列表 返回的列表项,另包含 certificate(证书 PEM 内容)。

参数名称 类型 描述
code Integer 状态码。示例值:200
msg String 提示信息。示例值:成功
data Object 上游返回的证书详情对象
data.certificate String SSL 证书,PEM 格式内容

4. 示例

示例1 查询证书详情

输入示例

GET /prod-api/acdn/ccdn/certificateRest/describeCustomCertificate?zoneId=551290393816e70c5e9765ca020e30a4&customCertificateId=8b0d6d0c72c14b21a7e39d4f5b1a2c3e

代码调用

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

curl -X GET 'https://{登录域名}/prod-api/acdn/ccdn/certificateRest/describeCustomCertificate?zoneId=551290393816e70c5e9765ca020e30a4&customCertificateId=8b0d6d0c72c14b21a7e39d4f5b1a2c3e' \
  -H 'Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.xxxxxx'
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;

public class DescribeCustomCertificateTest {

    public static void main(String[] args) throws Exception {
        String url = "https://{登录域名}/prod-api/acdn/ccdn/certificateRest/describeCustomCertificate"
                + "?zoneId=551290393816e70c5e9765ca020e30a4"
                + "&customCertificateId=8b0d6d0c72c14b21a7e39d4f5b1a2c3e";
        String token = "eyJhbGciOiJIUzUxMiJ9.xxxxxx";

        try (CloseableHttpClient httpClient = HttpClients.createDefault()) {
            HttpGet httpGet = new HttpGet(url);
            httpGet.setHeader("Authorization", "Bearer " + token);

            try (CloseableHttpResponse response = httpClient.execute(httpGet)) {
                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 (
    "fmt"
    "io"
    "net/http"
)

func main() {
    url := "https://{登录域名}/prod-api/acdn/ccdn/certificateRest/describeCustomCertificate" +
        "?zoneId=551290393816e70c5e9765ca020e30a4" +
        "&customCertificateId=8b0d6d0c72c14b21a7e39d4f5b1a2c3e"
    token := "eyJhbGciOiJIUzUxMiJ9.xxxxxx"

    req, err := http.NewRequest(http.MethodGet, url, nil)
    if err != nil {
        panic(err)
    }
    req.Header.Set("Authorization", "Bearer "+token)

    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": {
    "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,
    "certificate": "-----BEGIN CERTIFICATE-----\nMIIFJDCCBAygAwIBAgIQD0ifmj/Yi5NP...\n-----END CERTIFICATE-----\n"
  }
}

5. 错误码

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

HTTP 状态码 / 业务提示 描述
200 成功
401 未鉴权或 Token 无效
403 无权限,需具备 ccdn:domain:edit
无效的zoneId zoneId 不存在或不属于当前账号