All Documents
Current Document

Content is empty

If you don't find the content you expect, please try another search term

Documentation

ConfigCertificate

Last updated:2021-03-17 11:10:01

ConfigCertificate

Description

You can call this operation to configure a certificate for one or more domain names, including wildcard domain names such as *.a.com.

Request syntax

The API request contains the specified directory /2016-09-01/cert/ConfigCertificate, common request headers, and operation-specific request parameters. For more information, see the sample request.

Request parameters

Parameter Required Type Description
Enable Yes String Specifies whether to enable the certificate. Valid values: on and off. Default value: off. If the Enable parameter is set to on, the following parameters are required. If the Enable parameter is set to off, both HTTP 2.0 and forcible redirection are disabled.
DomainIds Yes String The ID of the domain name.
CertificateId No String The unique ID of the certificate generated by Kingsoft Cloud. If this parameter is specified, the following parameters are optional. Otherwise, the following parameters are required.
CertificateName No String The name of the certificate.
ServerCertificate No String The content of the certificate.
PrivateKey No String The private key that corresponds to the certificate.

Note: If the CertificateId parameter is specified, the CertificateName, ServerCertificate, and Privatekey parameters are ignored.

Error codes

Error code Error message HTTP status code Description
InvalidEnable.ValueNotSupported The specified value of parameter Enable is not supported. 400 The error message returned because the value of the Enable parameter is invalid.
ServerCertificate.MissingParameter An input parameter ServerCertificate that is mandatory for processing the request is not supplied. 400 The error message returned because the ServerCertificate parameter is required.
PrivateKey.MissingParameter An input parameter PrivateKey that is mandatory for processing the request is not supplied. 400 The error message returned because the PrivateKey parameter is required.
InvalidServerCertificate The ServerCertificate you provided is malformed! 400 The error message returned because the certificate is invalid.
InvalidPrivateKey The Private Key you provided is malformed! 400 The error message returned because the private key is invalid.
ServerCertificate.MissMatch The Private Key does not math the specified ServerCertificate! 400 The error message returned because the certificate does not match the private key.
InvalidServerCertificate.TooLong The ServerCertificate you provided is over the max length! 400 The error message returned because the size of the certificate or private key exceeds the upper limit, which is 16 KB.
InvalidServerCertificateName.TooLong The ServerCertificate name you provided is over the max length 128! 400 The error message returned because the certificate name exceeds 128 characters.
Certificate.Duplicated The Certificate name is duplicated. 400 The error message returned because the certificate name already exists.
Certificate.CertNull The Certificate is not null. 400 The error message returned because the certificate is empty.
Certificate.FormatError The Certificate format is error. 400 The error message returned because the certificate format is invalid.
Certificate.KeyNull The private key is not null. 400 The error message returned because the private key is empty.
Key.Malformed The private key format is error. 400 The error message returned because the private key format is invalid.
ServerCertificateName.NameNull The ServerCertificateName 400 The error message returned because the certificate name is empty.

Examples

Sample request

POST method:

POST /2016-09-01/cert/ConfigCertificate
Host: cdn.api.ksyun.com
X-Amz-Date: date
Authorization:authorization string
x-action: ConfigCertificate
x-version: 2016-09-01
Content-Type: application/json

{
    {
    "Enable":"on",
    "DomainIds":"2D08BS7",
    "CertificateName":"test",
    "ServerCertificate":"-----BEGIN CERTIFICATE-----\nMIIC2jCCAcKgAwIBAgIUUF4UPAJvGsvsrSmS4gjXfoyKWY8wDQYJKoZIhvcNAQEL\nBQAwGDEWMBQGA1UEAwwNZHlsYW5mZW5nLmNvbTAeFw0yMDEwMjkxMTU0MTBaFw0z\nMTA4MDIwMDAwMDBaMCExHzAdBgNVBAMMFnl1a2kuMTAzMC5rc2MtdGVzdC5jb20w\nggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDFBLkHpEGo5d8AdfMQzEls\nciXNv10gilLPFK+vDG/IItbdsttyA8J+s+HJtkZJatrzYFm2UPv/t6RB+gtCXi/c\nPOwRlb8H4J3t+a4ARJZZ2M8HxsRpwBllOvPrmwHMBnsq0iQVU7Mud2J1DSQJjDZt\nCrkpv0PtYg6tt704n/\nl7jc1Sac0RV8/n4Yia15cMlnxwIl1zTtIhL13cCXjWDAz1\n+lCL+puwhq6s42sLTF7g9wLFm9H9h7Wa+JLSKa63iPgW7ziDTudn1yX9fjyZScAi\nt+VzADo7FKGZl6WkfREKLYT9Dks1TLVEdF2sTxfvmq2h5H6A4FgfpW8aCJ3/WfdF\nAgMBAAGjEzARMA8GA1UdEwEB/\nwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAKrn\nsqWg6N2KC3d6C2VE5/pJAwzQTmUla8Jq+aMwnTkS38y8PN5XGln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Bz/UTqhixsMxL7SjmCWCI5/WIpfs9en86mnLeFrxwQKBgQD9Y0Uws/AtF7+5BkH9\nU3nfGSAfJnkBMlsYatZeCbQJuLguckcJjNkiS2B9mUWPvNtN1YjuHpSmhFUDdD32\nZAset9g65YdUyAjN3XtUVoL5ndrnvbUZ+kipHQqRo8pHYO2lbK+xTO0jERyUNASV\nljay7pP20o7TkfQKv6vdA0zNjQKBgQDHDK9hrPPOhQKtAmDqSGa0ysd5WT6EfWyX\nFz+YIJyEDCb67HjZtIqjSYK7RgILhU9V+WG8SdxB6h9s45Mvzu8bjuT/h/fHzbv8\n9ItiOtcP1/+BPbG+PaYebpQvI7c1NG+7nk+vzUF89sRT/aC6lhxqOFXfnptmwfxQ\nNF8pNy0WmQKBgQC61ylc2UH/riRkRZYBOz2BYaCK966AUGZVoeoCG3uTM480SHXT\nN/WgUR6MXqmpbKP1R8CZfRk1lByv2FYcSfbdJskd3MQmov3C908KiGQ5tcmF2iAh\nUKmlcdGqRLFSYsm5kmQXA9dUZTjCm3zJ5KLe3AdlGCvTHCtshZsv9E/8vQKBgEfe\nlaiP2QwVTI0JUdLlx2e52+I9zevqmX3IYCbeh4TKGnz5Sv1YScKBdVmHApAEV0v0\nmkxw4r1N+oDHfsqBTiZGJvr4rgePijPgXD9gfWx0EgYpL3dALS3JwWlv3OOyBjHZ\nDG6ujtm/A85Lwm/8aVAU/TSbwQKOQjr3XfC0wmvpAoGANKx56eIwMJwh+dqpzW8+\nXgCFqO+FIzrwCHafqgAzEgTREzLXJ4rR2SC/bbYhtCb+4Xb4gzS8bQ/ca5kSotX/\n5vBYfTfjVG36VZFLuPA8K5zYqlSqqH96LpZJdI1ZgODK9u6bzovwvguXpzBD/Prm\nqQFaxxzO8P2F6DBSeNJxPT8=\n-----END PRIVATE KEY-----"
}
}

Sample response

{
    "CertificateId": "6145"
}
On this page
Pure ModeNormal Mode

Pure Mode

Click to preview the document content in full screen
Feedback