查询证书列表

更新时间:2023-04-04 20:56:16

适用产品

CDN Pro

接口描述

获取证书列表。接口返回证书的ID、名称、部署到生产环境的版本、部署到演练环境的版本、最新的版本号、证书的最后更新时间以及证书的过期时间等信息。 证书列表默认按证书的最后更新时间降序排序。

推荐使用 Open API在线调试

Open API在线调试功能提供可视化界面在线调试API、支持生成代码示例、快速检索查看API文档等能力。前往调试

请求参数

Params 参数

参数名称描述
searchString
指定关键字,按证书名称查询证书。
offsetInteger
默认值: 0 取值范围: >= 0 查询起始位置。
limitInteger
默认值: 100 取值范围: <= 200 每次查询的最大条数。
targetString
取值范围: all,staging,production 根据证书的部署环境查询证书。
取值返回数据
当该参数为空时,返回所有证书,无论证书是否已部署。
all返回所有已部署的证书,包括部署到演练环境和生产环境的证书。
staging只返回部署到演练环境的证书。
production只返回部署到生产环境的证书。
autoRenewString
取值范围: LE,Off 根据是否设置自动更新来查询证书。LE指通过Let's Encrypt自动更新,Off指未开启自动更新。
sortByString
取值范围: creationTime,lastUpdateTime,expirationTime,productionExpirationTime 默认值: lastUpdateTime 查询结果的排序依据。支持按证书的创建时间,最后一次更新时间,证书过期时间,证书在生产环境中的版本的过期时间来排序。
sortOrderString
取值范围: asc,desc 默认值: desc 查询结果的排序顺序,即升序(asc)或者降序(desc)。

返回参数

Body 参数

参数名称描述
countInteger
取值范围: >= 0 证书的总数。返回的实际数量取决于查询参数。
certificatesList
证书列表。
certificateIdString
证书的ID。您可以通过调用'查询证书详情'接口来获取证书的详细信息。
nameString
证书名称。
latestVersionInteger
取值范围: >= 1 证书的最新版本。
autoRenewString
取值范围: LE,Off 如果您选择使用Let's Encrypt自动续订证书,则将此项设置为'LE'。
creationTimeString
RFC3339格式的日期,表示证书在CDN Pro的创建时间。
expirationTimeString
RFC3339格式的日期,表示证书最新版本的到期时间。
lastUpdateTimeString
RFC3339格式的日期,表示证书最近一次更新的时间。
versionInProductionInteger
取值范围: >= 1 证书部署到生产环境的版本。
versionInStagingInteger
取值范围: >= 1 证书部署到演练环境的版本。
productionExpirationTimeString
RFC3339格式的日期,表示部署到生产环境的版本的过期时间。
stagingExpirationTimeString
RFC3339格式的日期,表示部署到演练环境的版本的过期时间。
forceRenewBoolean
是否强制更新。当值为true时表示要求尽快自动更新证书,而不是等待证书在 15 天后过期。 证书成功更新后,该值将设置为false。

错误码

错误代码(code)描述(message)HTTP状态码语义
InvalidTargetInvalid target query parameter. Only "all", "staging", or "production" are allowed.400target参数无效,必须是"all","staging"或"production"。
InvalidAutoRenewThe value 'invalid' of autoRenew is invalid. Only 'LE' and 'Off' are allowed.400autoRenew参数无效,必须是'LE'或'Off'。
InvalidSortByThe valid sort by values for this endpoint are 'creationTime', 'lastUpdateTime', 'expirationTime'.400sortBy参数无效,必须是 'creationTime','lastUpdateTime'或 'expirationTime'。

示例

200
400
200
请求示例
复制代码 复制成功
#!/bin/bash
username="example_username"
apiKey="example_apiKey"
date=`env LANG="en_US.UTF-8" date -u "+%a, %d %b %Y %H:%M:%S GMT"`
password=`echo -en "$date" | openssl dgst -sha1 -hmac $apiKey -binary | openssl enc -base64`
curl -i --url "https://open.chinanetcenter.com/cdn/certificates" \
-X "GET" \
-u "$username:$password" \
-H "Date: $date" \
-H "Accept: application/json"
返回示例
复制代码 复制成功
{
    "count": 10,
    "certificates": [
        {
            "certificateId": "5c5a5fa5e9b2e00001ef0462",
            "name": "testCertificateA",
            "versionInProduction": 1,
            "latestVersion": 3,
            "autoRenew": "Off",
            "creationTime": "2019-02-06T04:16:37Z",
            "expirationTime": "2020-10-12T12:10:31Z",
            "lastUpdateTime": "2019-02-06T04:16:37Z",
            "productionExpirationTime": "2019-10-12T12:10:31Z"
        },
        {
            "certificateId": "5c5a6147e9b2e00001ef046f",
            "name": "testCertificateB",
            "latestVersion": 1,
            "autoRenew": "LE",
            "creationTime": "2019-02-06T04:23:35Z",
            "expirationTime": "2019-09-22T08:11:54Z",
            "lastUpdateTime": "2019-02-06T04:23:35Z"
        }
    ]
}
本篇文档内容对您是否有帮助?
有帮助
我要反馈
提交成功!非常感谢您的反馈,我们会继续努力做到更好!