Configures an SSL certificate for an accelerated domain name.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes SetDomainServerCertificate

The operation that you want to perform. Set the value to SetDomainServerCertificate.

DomainName String Yes www.yourdomain.com

The accelerated domain name to which the SSL certificate belongs. The accelerated domain name must have HTTPS secure acceleration enabled. You can specify multiple accelerated domain names and separate them with commas (,).

ServerCertificateStatus String Yes on

Specifies whether to enable the SSL certificate. Valid values:

  • on: enables the SSL certificate.
  • off: disables the SSL certificate. This is the default value.
ForceSet String No 1

Specifies whether to check the certificate name for duplicates. If you set the value to 1, the system does not perform the check and overwrites the information about the existing certificate that uses the same name.

Region String No cn-hangzhou

The region.

CertName String No myCert1

The name of the SSL certificate.

ServerCertificate String No xxxxxx

The content of the SSL certificate. Specify the content of the SSL certificate only if you want to enable the SSL certificate.

PrivateKey String No xxxxxxxx

The private key. Specify the private key only if you want to enable the SSL certificate.

CertType String No free

The type of the certificate. Valid values: Valid values:

  • upload: a user-uploaded SSL certificate.
  • cas: a certificate that is acquired through SSL Certificates Service
  • free: a free certificate

Response parameters

Parameter Type Example Description
RequestId String 16A96B9A-F203-4EC5-8E43-CB92E68F4CD8

The ID of the request.

Examples

Sample requests

http://cdn.aliyuncs.com?Action=SetDomainServerCertificate
&DomainName=example.com
&ServerCertificateStatus=on
&ServerCertificate=xxx
&PrivateKey=yyy
&<Common request parameters>

Sample success responses

XML format

<SetDomainServerCertificateResponse>
    <RequestId>8436769A-55D0-4DF8-BBA7-0DBC156D7AAF</RequestId>
</SetDomainServerCertificateResponse>

JSON format

{
  "RequestId": "0AEDAF20-4DDF-4165-8750-47FF9C1929C9"
}

Error codes

HttpCode Error code Error message Description
400 InvalidServerCertificateStatus.ValueNotSupported The specified value of parameter Enable is not supported. The error message returned because the Enable parameter is set to an invalid value. Valid values are on and off.
400 ServerCertificate.MissingParameter An input parameter "ServerCertificate" that is mandatory for processing the request is not supplied. The error message returned because the ServerCertificate parameter is missing.
400 PrivateKey.MissingParameter An input parameter "PrivateKey" that is mandatory for processing the request is not supplied. The error message returned because the PrivateKey parameter is missing.
400 InvalidCertificate The Certificate you provided is malformed! The error message returned because the format of the SSL certificate is invalid.
400 InvalidPrivateKey The Private Key you provided is malformed! The error message returned because the format of the SSL certificate is invalid.
400 Certificate.MissMatch The Private Key does not math the specified Certificate! The error message returned because the specified private key does not match the specified certificate type.
400 InvalidCertificate.TooLong The Certificate you provided is over the max length! The error message returned because the length of the specified certificate and private key exceeds the upper limit.
400 InvalidCertName.TooLong The Certificate name you provided is over the max length 128! The error message returned because the certificate name contains more than 128 characters.
403 IllegalOperation Illegal domain operate is not permitted. The error message returned because the specified operation is invalid.
400 AuthenticationFailed Authentication failed. The error message returned because identity authentication failed.
400 SetDomainServerCertificate.ParameterError Parameters have error. The error message returned because one or more parameters are set to an invalid value.
400 Certificate.NotFind Not find the certificate info. The error message returned because the specified SSL certificate does not exist.
400 Certificate.MissMatch The certificate is not match the private key. The error message returned because the specified SSL certificate and private key do not match.
400 Certificate.StatusError Certificate is not exist or its status is error. The error message returned because the specified certificate does not exist or the certificate status is invalid.
400 DeleteFailed Delete certificate is failed. The error message returned because the system failed to delete the specified certificate.
400 Certificate.Duplicated The certificate name is duplicated. The error message returned because the certificate already exists.
400 Certificate.FormatError The certificate format is error. The error message returned because the certificate format is invalid.
400 Certificate.StatusError The certificate status is error. The error message returned because the certificate status is invalid.
400 Certificate.KeyNull The private key is not null. The error message returned because the private key is not specified.
400 Key.Malformed The private key format is error. The error message returned because the format of the private key is invalid.
400 CertStorage.failed The certificate storage failed. The error message returned because the system failed to save the certificate.
400 CertificateContent.Duplicated The certificate is already uploaded, please don't upload again. The error message returned because the certificate had already been uploaded.
400 Certificate.Expired The certificate is expired. The error message returned because the certificate has expired.
400 InvalidDomain.notOnline The domain is not online, please check the domain status and try again later. The error message returned because the specified domain name is disabled. Check the domain status and try again later.
400 Decode.Error The certificate sslpub or sslpri decode error. The error message returned because the system failed to decode the public key or the private key of the SSL certificate.
400 sslPub.Error The sslPub encoded failed. The error message returned because the system failed to encode the public key of the SSL certificate.
400 sslPri.Error The sslPri encoded failed. The error message returned because the system failed to encode the private key of the SSL certificate.
400 DomainInSafeMode This domain is in the safe mode. if you want to do this operation, please contact us! The error message returned because the domain name is in security mode. To call this operation, submit a ticket.
400 DomainInProtectedMode This domain is in the protected mode. if you want to do this operation, please contact us! The error message returned because the specified domain name is being protected. To call this operation, contact Customer Service.

For a list of error codes, visit the API Error Center.