[TOC] ## 获取证书列表 ~~~[api] get:/v1/certs string:page=1#当前页码 limit=10#单页显示数量 name#模糊搜索证书名称 des#模糊搜索备注 cert_type#证书类型,可选值为lets, zerossl,custom integer:dnsapi#用到此dnsapi的证书 integer:expire#证书还有几天到期 boolean:enable#1为启用或者0为禁用 sync_state#证书同步状态,可选状态为done,pending,failed,process issue_state#证书签发状态,可选状态为done,pending,failed,process boolean:valid#指已经可以用于绑定网站的证书,即let's encrypt或zerossl证书已经签发好并同步,或者自上传的证书已经同步好 <<< 返回结果 { "code": 0, "count": 2, "data": [{ "auto_renew": 1, "create_at2": "2021-11-25 08:34:59", "domain": "for-test.cdnfly.cn", "enable": 1, "expire_time2": null, "id": 135, "issue_state": "failed", "name": "for-test.cdnfly.cn免费证书", "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.cdnfly.cn", "enable": 1, "expire_time2": "2022-02-14 23:59:59", "id": 134, "issue_state": null, "name": "for-test.cdnfly.cn", "retry_at2": null, "start_time": null, "sync_state": null, "task_enable": null, "task_ret": null, "type": "custom", "uid": 2, "update_at": null, "username": "jason" } ] } ~~~ ## 添加单个或多个证书 (多个证书时,数据格式为数组) ~~~[api] post:/v1/certs *string:name#证书名称 des#备注 *type#证书类型,可选为custom、lets、zerossl dnsapi#用于申请证书的dnsapi,通常用于通配符证书的申请 domain#申请证书的域名, 当证书类型为lets或zerossl时,此项必填 key#密钥内容,当证书类型为custom时,此项必填 cert#证书内容,当证书类型为custom时,此项必填 <<< 返回结果 { "code": 0, "data": "1", "msg": "证书添加成功" } <<< 提交内容 { "name": "for-test.cdnfly.cn证书", "domain": "for-test.cdnfly.cn", "type": "lets" } ~~~ ## 批量修改证书(提交的数据格式为数组) ~~~[api] put:/v1/certs integer:id#证书ID string:name#证书名称 des#备注 type#证书类型,可选为custom、lets、zerossl dnsapi#用于申请证书的dnsapi,通常用于通配符证书的申请 domain#申请证书的域名, 当证书类型为lets或zerossl时,此项必填 key#密钥内容,当证书类型为custom时,此项必填 cert#证书内容,当证书类型为custom时,此项必填 boolean:auto_renew#是否自动续签 boolean:enable#禁用或启用 reissue#设置为1时,表示需要重签证书 <<< 返回结果 { "code": 0, "data": "", "msg": "更新证书成功" } <<< 提交内容 [{ "id": 1, "enable": 0 }, { "id": 2, "enable": 0 }] ~~~ ## 获取单个证书内容 ~~~[api] get:/v1/certs/<证书ID> <<< 返回结果 { "code": 0, "data": { "auto_renew": 1, "cert": "xxx", "create_at": null, "des": "", "dnsapi": null, "domain": "for-test.cdnfly.cn", "enable": 1, "expire_time": null, "id": 134, "issue_task_id": null, "key": "xxx", "name": "for-test.cdnfly.cn", "start_time": null, "task_id": null, "type": "custom", "uid": 2, "update_at": null, "version": 1 }, "msg": null } ~~~ ## 修改单个证书 ~~~[api] put:/v1/certs/<证书ID> string:name#证书名称 des#备注 type#证书类型,可选为custom、lets、zerossl dnsapi#用于申请证书的dnsapi,通常用于通配符证书的申请 domain#申请证书的域名, 当证书类型为lets或zerossl时,此项必填 key#密钥内容,当证书类型为custom时,此项必填 cert#证书内容,当证书类型为custom时,此项必填 boolean:auto_renew#是否自动续签 boolean:enable#禁用或启用 reissue#设置为1时,表示需要重签证书 <<< 返回结果 { "code": 0, "data": "", "msg": "更新证书成功" } <<< 提交内容 { "name": "新名称" } ~~~ ## 删除证书 ~~~[api] delete:/v1/certs/<证书ID,多个以逗号分隔> <<< 返回结果 { "code": 0, "data": "", "msg": "证书删除成功" } ~~~