Add & Modify Domain Name Certificate
Last Updated:2021-10-13
Interface
If the domain has been bound to a certificate id, the interface is modified. Replace the old certificate in the certificate library with the new one uploaded by the user, and bind the id of the new certificate to the domain. If the domain is not bound to a certificate, the interface is used to upload a new certificate and bind the new certificate id to the domain.
Method | Path | Description |
---|---|---|
PUT | /v2/{domain}/certificates | Add or modify the certificate bound to the domain. |
url Parameters
Parameters | Optional | Type | Description |
---|---|---|---|
domain | Required | string | Domain name associated with the target certificate |
Request Body
Parameters | Optional | Type | Description |
---|---|---|---|
httpsEnable | Required | string | The value can be "ON" or "OFF" only to indicate whether HTTPS is enabled. "ON" indicates that it is enabled, and "OFF" indicates that it is disabled. |
certificate | Required | certificate | Certificate content |
Description of certificate parameters
Parameters | Optional | Type | Description |
---|---|---|---|
certName | String | Required | Name of Certificate. The length is limited to 1-65 characters, starting with a letter. It can only contain letters, numbers, and such symbols as '-', '/', '.', ‘,’, or '*'. The Java regular expression is ^[a-zA-Z][a-zA-Z0-9\-/_\.\*]{0,64}$ |
certServerData | String | Required | Data content of the server certificate (Base64 encoded) |
certPrivateData | String | Required | Private key data content of the certificate (Base64 encoded) |
certLinkData | String | Optional | Certificate chain data content (Base64 code) |
certType | Integer | Optional | Certificate type, which can be 1 only. 1 means the server certificate. If this item is not passed, the default value is also 1. |
Response Body
Parameters | Optional | Type | Description |
---|---|---|---|
certId | Required | string | CertId after the certificate is stored |
Request Example
Add a certificate for the domain name www.example.com, and enable 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",
"certServ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PD6PypvVpQ4fkg58EJsFKwkGYTgcfS9dfwsjWbOTNW5gM/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-----"
}
}
Response example
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"}