跳转至

列出证书

1. 接口描述

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

describeCertificate 用于分页查询当前账号下的海外 ACDN 证书列表,支持按域名、证书主题及颁发机构模糊搜索。

需要权限 acdn:distributions:edit,策略 acdn:DescribeCertificateacdn:DescribeAllDistribution

Token 获取方式见 密钥鉴权

2. 输入参数

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

参数名称 必选 类型 描述
pageNum Integer 当前页数
示例值:1
pageSize Integer 每页显示条目个数
示例值:10
search String 搜索关键字,匹配 DNS 名称、证书主题或颁发机构
示例值:demo.com

3. 示例

示例1 分页查询证书列表

输入示例

{
  "pageNum": 1,
  "pageSize": 10,
  "search": ""
}

代码调用

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

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

        String requestBody = "{"
                + "\"pageNum\":1,"
                + "\"pageSize\":10,"
                + "\"search\":\"\""
                + "}";

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

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

    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": 1,
  "rows": [
    {
      "certId": 1,
      "source": 0,
      "endTime": "2023-10-08 07:59:59",
      "beginTime": "2023-07-08 07:59:59",
      "subjectDN": "*.demo.com",
      "issuerDN": "Sectigo RSA Domain Validation Secure Server CA",
      "dnsName": "*.demo.com",
      "relatesId": "arn:aws:1234687:654268366154:certificate/18ecb30b-7ad5-40fa-9b62-702b8750a3ab",
      "status": 3
    }
  ],
  "code": 200,
  "msg": "查询成功"
}

4. 输出参数

参数名称 类型 描述
code Integer 状态码。示例值:200
msg String 提示信息。示例值:查询成功
total Integer 证书总条数。示例值:1
rows Array 当前页证书列表
rows[].certId Integer 证书 ID。示例值:1
rows[].source Integer 证书来源,支持以下值:
0:导入证书
3:平台申请证书。示例值:0
rows[].beginTime String 生效时间。示例值:2023-07-08 07:59:59
rows[].endTime String 到期时间。示例值:2023-10-08 07:59:59
rows[].subjectDN String 证书主题(域名)。示例值:*.demo.com
rows[].issuerDN String 颁发机构。示例值:Sectigo RSA Domain Validation Secure Server CA
rows[].dnsName String DNS 名称。示例值:*.demo.com
rows[].relatesId String 外部证书 ARN。示例值:arn:aws:1234687:654268366154:certificate/18ecb30b-7ad5-40fa-9b62-702b8750a3ab
rows[].status Integer 证书状态,支持以下值:
0:正常
1:待验证
2:处理中
3:已颁发
4:验证失败。示例值:3

5. 错误码

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