跳转至

查询 SSL 托管证书

1. 接口描述

接口请求路径:POST /prod-api/cdn/ssl/hosting/describeHosting

describeHosting 用于分页查询当前账号下的 SSL 托管证书列表,支持按别名、证书类型(颁发者)筛选,并可按到期天数过滤。

Token 获取方式见 密钥鉴权

2. 输入参数

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

参数名称 必选 类型 描述
pageNum Integer 当前页数
示例值:1
pageSize Integer 每页显示条目个数
示例值:10
filters Array 搜索条件列表
filters.label String 搜索字段,支持以下值:
alias:别名
issuerDN:证书类型(颁发者)
示例值:alias
filters.value Array of String 搜索值。传入单个值为模糊搜索,多个值为精确搜索
示例值:["*.demo.com"]
searchHeader Object 筛选条件
searchHeader.certEndDay String 按到期时间筛选,支持以下值:
7:7 天内到期
30:30 天内到期
示例值:7

3. 示例

示例1 分页查询托管证书

输入示例

{
  "pageNum": 1,
  "pageSize": 10,
  "filters": [],
  "searchHeader": {}
}

代码调用

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

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

        String requestBody = "{"
                + "\"pageNum\":1,"
                + "\"pageSize\":10,"
                + "\"filters\":[],"
                + "\"searchHeader\":{}"
                + "}";

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

    requestBody := []byte(`{
  "pageNum": 1,
  "pageSize": 10,
  "filters": [],
  "searchHeader": {}
}`)

    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))
}

输出示例

{
  "total": 6,
  "rows": [
    {
      "certId": 91,
      "status": 0,
      "dnsName": "*.demo.com,demoy.com",
      "alias": "*.demoy.com",
      "sslcrt": "-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----",
      "subjectDN": "*.demoyy.com",
      "issuerDN": "RapidSSL TLS RSA CA G1",
      "beginTime": null,
      "endTime": "2025-04-23 07:59:59",
      "createTime": "2024-09-07 17:12:14"
    }
  ],
  "code": 200,
  "msg": "成功"
}

4. 输出参数

参数名称 类型 描述
code Integer 状态码。示例值:200
msg String 提示信息。示例值:成功
total Integer 符合条件的总条数。示例值:6
rows Array 托管证书列表
rows[].certId Integer 证书 ID。示例值:91
rows[].status Integer 证书状态,支持以下值:
0:正常(上传托管)
1:待验证
2:处理中
3:已颁发
4:失败
5:取消
示例值:0
rows[].dnsName String 证书覆盖的其他域名(SAN),多个以逗号分隔
rows[].alias String 别名
rows[].sslcrt String 证书内容(PEM)
rows[].subjectDN String 通用名称(CN)
rows[].issuerDN String 证书类型 / 颁发者
rows[].beginTime String 证书生效时间;可能为空
rows[].endTime String 到期时间,格式 yyyy-MM-dd HH:mm:ss
示例值:2025-04-23 07:59:59
rows[].createTime String 提交/创建时间,格式 yyyy-MM-dd HH:mm:ss
示例值:2024-09-07 17:12:14

5. 错误码

HTTP 状态码 / 业务提示 描述
200 成功
401 未鉴权或 Token 无效
403 无权限