CDNHAO使用文档

获取证书列表

GET /v1/certs
pagestring
当前页码
limit
单页显示数量
name
模糊搜索证书名称
des
模糊搜索备注
cert_type
证书类型,可选值为lets, zerossl,custom
dnsapiinteger
用到此dnsapi的证书
expireinteger
证书还有几天到期
enableboolean
1为启用或者0为禁用
sync_state
证书同步状态,可选状态为done,pending,failed,process
issue_state
证书签发状态,可选状态为done,pending,failed,process
validboolean
指已经可以用于绑定网站的证书,即let's encrypt或zerossl证书已经签发好并同步,或者自上传的证书已经同步好
{
	"code": 0,
	"count": 2,
	"data": [{
			"auto_renew": 1,
			"create_at2": "2021-11-25 08:34:59",
			"domain": "for-test.cdnhao.com",
			"enable": 1,
			"expire_time2": null,
			"id": 135,
			"issue_state": "failed",
			"name": "for-test.cdnhao.com免费证书",
			"retry_at2": "2021-11-25 08:50:10",
			"start_time": null,
			"sync_state": null,
			"task_enable": 1,
			"task_ret": "xxx",
			"type": "lets",
			"uid": 2,
			"update_at": null,
			"username": "jason"
		},
		{
			"auto_renew": 1,
			"create_at2": "2021-11-16 15:00:03",
			"domain": "for-test.cdnhao.com",
			"enable": 1,
			"expire_time2": "2022-02-14 23:59:59",
			"id": 134,
			"issue_state": null,
			"name": "for-test.cdnhao.com",
			"retry_at2": null,
			"start_time": null,
			"sync_state": null,
			"task_enable": null,
			"task_ret": null,
			"type": "custom",
			"uid": 2,
			"update_at": null,
			"username": "jason"
		}
	]
}

添加单个或多个证书 (多个证书时,数据格式为数组)

POST /v1/certs
namestring
required证书名称
des
备注
type
required证书类型,可选为custom、lets、zerossl
dnsapi
用于申请证书的dnsapi,通常用于通配符证书的申请
domain
申请证书的域名, 当证书类型为lets或zerossl时,此项必填
key
密钥内容,当证书类型为custom时,此项必填
cert
证书内容,当证书类型为custom时,此项必填
{
  "code": 0, 
  "data": "1", 
  "msg": "证书添加成功"
}
{
	"name": "for-test.cdnhao.com证书",
	"domain": "for-test.cdnhao.com",
	"type": "lets"
}

批量修改证书(提交的数据格式为数组)

PUT /v1/certs
idinteger
证书ID
namestring
证书名称
des
备注
type
证书类型,可选为custom、lets、zerossl
dnsapi
用于申请证书的dnsapi,通常用于通配符证书的申请
domain
申请证书的域名, 当证书类型为lets或zerossl时,此项必填
key
密钥内容,当证书类型为custom时,此项必填
cert
证书内容,当证书类型为custom时,此项必填
auto_renewboolean
是否自动续签
enableboolean
禁用或启用
reissue
设置为1时,表示需要重签证书
{
  "code": 0, 
  "data": "", 
  "msg": "更新证书成功"
}
[{
	"id": 1,
	"enable": 0
}, {
	"id": 2,
	"enable": 0
}]

获取单个证书内容

GET /v1/certs/<证书ID>
actionstring
为download时,为下载证书,同时需要指定access_token
access_tokenstring
登录用户时返回的access_token,需要把/替换为_,+替换为-
{
	"code": 0,
	"data": {
		"auto_renew": 1,
		"cert": "xxx",
		"create_at": null,
		"des": "",
		"dnsapi": null,
		"domain": "for-test.cdnhao.com",
		"enable": 1,
		"expire_time": null,
		"id": 134,
		"issue_task_id": null,
		"key": "xxx",
		"name": "for-test.cdnhao.com",
		"start_time": null,
		"task_id": null,
		"type": "custom",
		"uid": 2,
		"update_at": null,
		"version": 1
	},
	"msg": null
}

修改单个证书

PUT /v1/certs/<证书ID>
namestring
证书名称
des
备注
type
证书类型,可选为custom、lets、zerossl
dnsapi
用于申请证书的dnsapi,通常用于通配符证书的申请
domain
申请证书的域名, 当证书类型为lets或zerossl时,此项必填
key
密钥内容,当证书类型为custom时,此项必填
cert
证书内容,当证书类型为custom时,此项必填
auto_renewboolean
是否自动续签
enableboolean
禁用或启用
reissue
设置为1时,表示需要重签证书
{
  "code": 0, 
  "data": "", 
  "msg": "更新证书成功"
}
{
	"name": "新名称"
}

删除证书

DELETE /v1/certs/<证书ID,多个以逗号分隔>
{
  "code": 0, 
  "data": "", 
  "msg": "证书删除成功"
}