增加&修改域名证书
更新时间:2021-03-31
接口
如果domain已经绑定了一个证书id,则该接口为修改(将用户新上传的证书替换掉证书库中的老证书,且给domain绑定新证书的id)。 如果domain之前没有绑定证书,则该接口为上传新证书且将新的证书id绑到domain上。
method | path | 说明 |
---|---|---|
PUT | /v2/{domain}/certificates | 增加or修改domain绑定的certificate |
url参数
参数 | 可选 | 类型 | 说明 |
---|---|---|---|
domain | 必选 | string | 关联目标证书的域名 |
请求体
参数 | 可选 | 类型 | 说明 |
---|---|---|---|
httpsEnable | 必选 | string | 只能取值"ON"或者"OFF",表示是否开启https支持,“ON”开启,“OFF”关闭 |
certificate | 必选 | certificate | 证书内容 |
certificate参数说明
参数 | 可选 | 类型 | 说明 |
---|---|---|---|
certName | String | 必须 | 证书的名称。长度限制为1-65个字符,以字母开头,只允许包含字母、数字、’-‘、’/’、’.’、’_’、’*’,Java正则表达式 ^[a-zA-Z][a-zA-Z0-9\-/_\.\*]{0,64}$ |
certServerData | String | 必须 | 服务器证书的数据内容 (Base64编码) |
certPrivateData | String | 必须 | 证书的私钥数据内容 (Base64编码) |
certLinkData | String | 可选 | 证书链数据内容 (Base64编码) |
certType | Integer | 可选 | 证书类型,只能取1。1表示的是服务端证书,如果不传此项那么默认的取值也是1。 |
响应体
参数 | 可选 | 类型 | 说明 |
---|---|---|---|
certId | 必选 | string | 证书入库后的certId |
请求示例
为域名www.example.com添加证书,并开启https。
PUT /v2/www.example.com/certificates HTTP/1.1
Host: cdn.baidubce.com
User-Agent: curl/7.73.0
Accept: */*
Authorization: bce-auth-v1/2a1239f7075a46639fb68de8a4c3269b/2021-03-23T08:54:53Z/1800/host/5c97619e8aeba14d8d1587ba17f57d4a525d129b9072daaf9c34671777f63aab
x-bce-date: 2021-03-23T08:54:53Z
x-bce-request-id: 046fc79a-9eb7-450e-a745-18e0cfeb4546
Content-Length: 5363
Content-Type: application/json
{
"httpsEnable": "ON",
"certificate": {
"certName": "test",
"certServerData": "-----BEGIN CERTIFICATE-----\nMII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cfS9dfwsjWbOTNW5gM/hCKgI/LTjsU7a0YYH\nvEMCTim81kuUKZ9rYlfXqB1Xzk9k6mUFeoP4t5KCe79YFi1A\nBUxqHUArJiLyO1g8cZruKK37DQKpT0sYHw7AAaMCgYBuSNUc1yiDVTSn51M0xbdg\nJsa9t9qyaJPLJoB8SaN3h8vdth9CnlE4TH/ZHLPAf4NiAi3isEI1Svrv+WiaGKIc\nixkcx4xSlnd0EFakeUv5elz2NuY6lluKnDBO4aHyEcvt+UtOy7Me47ssVQkuSPMF\n7Tk8aUNG4NA0byFdiihHCQKBgQCBXOkh4CLaJb8LGgMjnbdMAiaYhPHUPExwIo4V\nF2i1acxV+PPIPl4zfdlgEF/gjSvk7E6SMIuG0haaM4bu5xTL7zSC38kcflkQI9Ja\nWy6WYJFh6kjsdfguDn+7bVfVGOqexv/j/wRLhBhzsrxvZOO\negbHjQKBgEe3ghxGKW8dl3+/PDZ3KF8YBb5xUxe9BO8ufM0Pe+tCn8iWrTeAHG16\ncl9JgGlN9eIgx9VOh7suKlb9SsZLbAN60IO9nIx23g2nLqH+HyEZmE6zK5onSxua\n9vgcKjhNmg5WLvmQwz0ECw050HtDpptawvfNPinUY1LsjvkWqwiX\n-----END RSA PRIVATE KEY-----"
}
}
响应示例
HTTP/1.1 200 OK
Server: nginx/1.1.10
Date: Tue, 23 Mar 2021 08:55:03 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
X-Powered-By: PHP/7.2.28
x-bce-request-id: 046fc79a-9eb7-450e-a745-18e0cfeb4546
{"certId":"cert-ijq0bjntwfb3"}