OpenAPI-申请证书
快速开始
申请证书流程如下
公共请求头
名称 | 类型 | 必填 | 描述 | 示例 |
---|---|---|---|---|
OpenApiKey | String | 是 | 在控制台个人中心查看 | xxxxxxxxx |
Content-Type | String | 是 | 必须为application/json |
一、验证域名
申请证书前,需要先验证域名,验证通过后可以申请证书。
请求
bash
POST https://openapi.httpsok.com/v1/cert/dv
bash
{
"domainList": [ "*.example.com", "example.com"]
}
名称 | 类型 | 必填 | 默认 | 描述 | 示例 |
---|---|---|---|---|---|
domainList | List<String> | 是 | 无 | 域名列表 |
响应
json
{
"code": 0,
"msg": "success",
"data": {
"configs": [
{
"domain": "*.httpsok.com",
"host": "_acme-challenge",
"hostValue": "68bf0af7b3854cdd.httpsok.com",
"valid": true
}
],
"valid": true
},
"traceId": "684c741fdb871fdd218c78b8ba438252"
}
json
{
"code": 0,
"msg": "success",
"data": {
"configs": [
{
"domain": "*.baidu.com",
"host": "_acme-challenge",
"hostValue": "e9e40d3bf04d9c74.httpsok.com",
"valid": false
}
],
"valid": false
},
"traceId": "b60de4b59b6f4aa179b946e31694544e"
}
二、提交申请
域名验证通过后,可以提交证书申请。返回 申请ID
。
请求
bash
POST https://openapi.httpsok.com/v1/cert/apply
bash
{
"domainList": [ "*.example.com", "example.com"]
}
名称 | 类型 | 必填 | 默认 | 描述 | 示例 |
---|---|---|---|---|---|
domainList | List<String> | 是 | 无 | 域名列表 | |
algorithm | String | 否 | ECC | 签名算法:ECC RSA | ECC |
ca | String | 否 | 证书厂商:google letsencrypt zerossl | ||
notifyUrl | String | 否 | 无 | 申请成功回调地址 |
响应
json
{
"code": 0,
"msg": "success",
"data": "236417",
"traceId": "e9fb0dd488529912085f304dde3b9d6d"
}
三、获取证书
申请提交成功后,可以根据 申请ID
获取证书。 也可以通过设置 notifyUrl
获取证书。
提示:请至少间隔 10秒
再发起下一次检测。
请求
bash
GET https://openapi.httpsok.com/v1/cert/apply/{id}
名称 | 类型 | 必填 | 默认 | 描述 | 示例 |
---|---|---|---|---|---|
id | String | 是 | 无 | 申请ID | 236417 |
响应
json
{
"code": 0,
"msg": "success",
"data": {
"id": 236417,
"status": 1,
"algorithm": "ECC",
"ca": "google",
"name": "*.httpsok.com",
"domains": "*.httpsok.com,httpsok.com",
"notBefore": "2024-12-11 00:24:32",
"notAfter": "2025-03-11 00:24:31",
"certificate": "-----BEGIN CERTIFICATE-----\nMIIEc******AgIbCgj8=\n-----END CERTIFICATE-----\n",
"privateKey": "-----BEGIN EC PRIVATE KEY-----\nMHcCA******58jQ==\n-----END EC PRIVATE KEY-----\n",
"fingerprints": "36daaafc34e7be4f9aa65448bc4f2703e5a5d8234e22ca07489ca061a78f3440",
"progress": 100
},
"traceId": "90cbafed99058a23c8cd08553701164d"
}
json
{
"code": 0,
"msg": "success",
"data": {
"id": 236417,
"status": 2,
"domains": "*.httpsok.com,httpsok.com",
"progress": 75
},
"traceId": "9f26694a6045a300a63b3bde621184a9"
}
响应数据说明
名称 | 类型 | 描述 |
---|---|---|
id | String | 申请ID |
status | int | 状态: 1 签发成功、 2 签发中、 3 签发失败 |
ca | String | 证书厂商: google letsencrypt zerossl |
algorithm | String | 签名算法:ECC RSA |
domains | String | 证书域名列表 |
notBefore | String | 生效时间 |
notAfter | String | 失效时间 |
certificate | String | 证书内容 |
privateKey | String | 证书私钥 |
fingerprints | String | 证书指纹 |
progress | String | 申请进度(百分值) |
申请成功回调
证书申请成功后会通过 POST
的请求方式,向 notifyUrl
发送回调通知
响应
json
{
"id": 236417,
"status": 1,
"algorithm": "ECC",
"ca": "google",
"name": "*.httpsok.com",
"domains": "*.httpsok.com,httpsok.com",
"notBefore": "2024-12-11 00:24:32",
"notAfter": "2025-03-11 00:24:31",
"certificate": "-----BEGIN CERTIFICATE-----\nMIIEc******AgIbCgj8=\n-----END CERTIFICATE-----\n",
"privateKey": "-----BEGIN EC PRIVATE KEY-----\nMHcCA******58jQ==\n-----END EC PRIVATE KEY-----\n",
"fingerprints": "36daaafc34e7be4f9aa65448bc4f2703e5a5d8234e22ca07489ca061a78f3440",
"progress": 100
}
响应数据说明
名称 | 类型 | 描述 |
---|---|---|
id | String | 申请ID |
status | int | 状态: 1 签发成功、 2 签发中、 3 签发失败 |
ca | String | 证书厂商: google letsencrypt zerossl |
algorithm | String | 签名算法:ECC RSA |
domains | String | 证书域名列表 |
notBefore | String | 生效时间 |
notAfter | String | 失效时间 |
certificate | String | 证书内容 |
privateKey | String | 证书私钥 |
fingerprints | String | 证书指纹 |
progress | String | 申请进度(百分值) |