Adding a Certificate to a Domain Name
Function
When you create an API to be accessed through HTTPS, you must add an SSL certificate to the independent domain name that has been bound to the group the API belongs to.
This API is used to add a certificate to a specific domain name.
URI
POST /v2/{project_id}/apigw/instances/{instance_id}/api-groups/{group_id}/domains/{domain_id}/certificate
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID. For details about how to obtain a project ID, see "Appendix" > "Obtaining a Project ID" in this document. |
instance_id |
Yes |
String |
Gateway ID, which can be obtained from the gateway information on the APIG console. |
group_id |
Yes |
String |
API group ID. |
domain_id |
Yes |
String |
Domain ID. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
User token. It can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is a token. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
cert_content |
Yes |
String |
Certificate content. |
name |
Yes |
String |
Certificate name. It can contain 4 to 50 characters, starting with a letter. Only letters, digits, and underscores (_) are allowed. |
private_key |
Yes |
String |
Private key. |
Response Parameters
Status code: 201
Parameter |
Type |
Description |
---|---|---|
url_domain |
String |
Custom domain name. |
id |
String |
Domain ID. |
status |
Integer |
CNAME resolution status.
Enumeration values:
|
min_ssl_version |
String |
Minimum SSL version supported. |
is_http_redirect_to_https |
Boolean |
Whether to enable HTTP redirection to HTTPS. The value false means disable and true means enable. The default value is false. Default: false |
verified_client_certificate_enabled |
Boolean |
Whether to enable client certificate verification. This parameter is available only when a certificate is bound. It is enabled by default if trusted_root_ca exists, and disabled if trusted_root_ca does not exist. Default: false |
ssl_name |
String |
Certificate name. |
ssl_id |
String |
Certificate ID. |
Status code: 400
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error message. |
Status code: 401
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error message. |
Status code: 403
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error message. |
Status code: 404
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error message. |
Status code: 500
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error message. |
Example Requests
{ "name" : "cert_demo", "private_key" : "'-----BEGIN CERTIFICATE-----\\nMIIEcDCCAtigAwIBAgIRAKUYqTtQbsPhVauuteGD8kMwDQYJKoZIhvcNAQELBQAw\\ngZMxHjAcBgNVBAoTFW1rY2VydCBkZXZlbG9wbWVudCBDQTE0MDIGA1UECwwrQ0hJ\\nTkFcbDAwNDk1MzA1QERFU0tUT1AtTDJURk9GSCAobGl1cnVpeHVlKTE7MDkGA1UE\\nAwwybWtjZXJ0IENISU5BXGwwMDQ5NTMwNUBERVNLVE9QLUwyVEZPRkggKGxpdXJ1\\naXh1ZSkwHhcNMTkwNjAxMDAwMDAwWhcNMzAwODA0MDc0MTE5WjBfMScwJQYDVQQK\\nEx5ta2NlcnQgZGV2ZWxvcG1lbnQgY2VydGlmaWNhdGUxNDAyBgNVBAsMK0NISU5B\\nXGwwMDQ5NTMwNUBERVNLVE9QLUwyVEZPRkggKGxpdXJ1aXh1ZSkwggEiMA0GCSqG\\nSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDYvPx9H8ZY9iUf5A8hT8s/gTThEOa3nswW\\njxxU58+dIiwvzdIioc+CaggMz/rjT3bt9jRilKvzkJjryUxLNOe3JsdJogm0OSxc\\nSJWOhdZd/vScImWajM5t3M/M7xgt1g813PNEVJ/uTaEwm6K3sAlqGJfgiU/ep6pb\\nI4S9i1c3VYLTfGF2ND5kTaysp69/mXl4IUDWn82n0TpjB4BvoiYD9ORMcvBBGCBh\\nnU2x497Uyo0X/MkreoxLxLEO2s4/TZfpZ0Ezsi/yHwjTRQ0ut53IKbSZDoBf3HLE\\nPw1Y4q2s4qjN6ImZmkYX+Qvx5MxdHCNsfPsDFTYX2rl+vCpqtDW/AgMBAAGjcjBw\\nMA4GA1UdDwEB/w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8p5IMRXNnDwhEbah+rcjkm\\nxAewQfzPr04Qqk5EGQsMZX4sOHCTsf/uG3QlTQenrs2ZUF5u3wJCh+YcIbs3au/f\\nQZPqW1Dn0H9wtRrq4fUgdXnV/G+FreffKjSgNaP3AoGAT8wX6ZszA5HrIGSo4pi7\\nDnbMNuYe1cpcyoAi178YVklom6uGutIiafngapViESKZ0Y8X/lYzU6ELclimqJPB\\nXD4nSD64YVvi+TjzwLK61tEUuAnYlWrtXQORWPQ5tHGlhCZPrciO2QH5P9cxoU3Z\\npGfmyACUF4Od9tdq4t4S9j4=\\n-----END PRIVATE KEY-----\\n'" }
Example Responses
Status code: 201
Created
{ "ssl_name" : "cert_demo", "url_domain" : "www.example.com", "ssl_id" : "a27be832f2e9441c8127fe48e3b5ac67", "id" : " f6bb84ccf1c34035878aa51b7253b21c", "status" : 3 }
Status code: 400
Bad Request
{ "error_code" : "APIG.2012", "error_msg" : "Invalid parameter value,parameterName:name. Please refer to the support documentation" }
Status code: 401
Unauthorized
{ "error_code" : "APIG.1002", "error_msg" : "Incorrect token or token resolution failed" }
Status code: 403
Forbidden
{ "error_code" : "APIG.1005", "error_msg" : "No permissions to request this method" }
Status code: 404
Not Found
{ "error_code" : "APIG.3020", "error_msg" : "The URL domain does not exist" }
Status code: 500
Internal Server Error
{ "error_code" : "APIG.9999", "error_msg" : "System error" }
Status Codes
Status Code |
Description |
---|---|
201 |
Created |
400 |
Bad Request |
401 |
Unauthorized |
403 |
Forbidden |
404 |
Not Found |
500 |
Internal Server Error |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.