跳转至

查询证书可配置域名

1. 接口描述

接口请求路径:POST /prod-api/cdn/layer7/ssl/describeSSLInfo

describeSSLInfo 用于根据证书(自有证书内容或托管证书 ID)解析证书覆盖域名,并返回当前账号下可与该证书匹配的域名列表,便于批量配置前预览。

Token 获取方式见 密钥鉴权

2. 输入参数

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

参数名称 必选 类型 描述
source Integer 证书来源,支持以下值:
0:自有证书
1:托管证书
示例值:1
certId Integer 托管证书 ID。source1 时必选
示例值:86
sslCert String PEM 证书内容。source0 时必选
sslKey String PEM 私钥内容。source0 时必选,用于校验证书与密钥是否匹配

3. 示例

示例1 按托管证书查询可配置域名

输入示例

{
  "source": 1,
  "certId": 86,
  "sslKey": "",
  "sslCert": ""
}

代码调用

请将 {登录域名}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 DescribeSSLInfoTest {

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

        String requestBody = "{"
                + "\"source\":1,"
                + "\"certId\":86,"
                + "\"sslKey\":\"\","
                + "\"sslCert\":\"\""
                + "}";

        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/layer7/ssl/describeSSLInfo"
    token := "eyJhbGciOiJIUzUxMiJ9.xxxxxx"

    requestBody := []byte(`{
  "source": 1,
  "certId": 86,
  "sslKey": "",
  "sslCert": ""
}`)

    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": {
    "dnsName": "demo.com",
    "domains": [
      {
        "port": 0,
        "domain": "*.demo.com",
        "id": 194,
        "sslsupport": 0,
        "protocol": 0,
        "endTime": null
      }
    ]
  }
}

4. 输出参数

参数名称 类型 描述
code Integer 状态码。示例值:200
msg String 提示信息。示例值:操作成功
data SSLMatchInfo 证书匹配结果

5. 错误码

HTTP 状态码 / 业务提示 描述
200 成功
401 未鉴权或 Token 无效
403 无权限
请输入正确的证书来源 source 不是 0 / 1
请填写证书 自有证书未传 sslCert
请填写证书密钥 自有证书未传 sslKey
证书信息异常,请重试 托管证书不属于当前账号
证书信息解析失败,请确认证书是否正确 自有证书解析失败
证书状态异常,请刷新后重试 托管证书状态异常或不存在

6. 数据模型

SSLMatchInfo

证书解析与可配置域名。

参数名称 类型 描述
dnsName String 证书覆盖域名(可能为逗号分隔多个)。示例值:demo.com
domains [SSLMatchDomain] 当前账号下可匹配的域名列表

SSLMatchDomain

可匹配域名项。

参数名称 类型 描述
id Integer 域名 ID。示例值:194
domain String 域名。示例值:*.demo.com
port Integer 端口。示例值:0
sslsupport Integer 是否已配置证书,支持以下值:
0:未配置
1:已配置
示例值:0
protocol Integer 回源协议,支持以下值:
0:HTTP
1:协议跟随
示例值:0
endTime String 当前绑定证书到期时间,可能为 null。示例值:2025-07-01 19:41:53