All Products
Search
Document Center

CDN:SetDomainServerCertificate

Last Updated:Nov 29, 2024
This API is deprecated. You are advised to use Cdn(2018-05-10) - SetCdnDomainSSLCertificate.

Configures an SSL certificate for an accelerated domain name.

Operation description

  • You can call this operation up to 10 times per second per user.
  • Method: POST.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
cdn:SetDomainServerCertificatenone
*Domain
acs:cdn:*:{#accountId}:domain/{#DomainName}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
DomainNamestringYes

The accelerated domain name for which you want to configure the SSL certificate. The type of request supported by the domain name must be HTTPS.

You can specify one domain name in each call.

example.com
CertNamestringNo

The name of the SSL certificate. You can specify only one name.

myCert1
CertTypestringNo

The type of the certificate. Valid values:

  • upload: a user-uploaded SSL certificate.
  • cas: a certificate that is purchased from Alibaba Cloud SSL Certificates Service.
Note If this parameter is set to cas, the PrivateKey parameter is optional.
cas
ServerCertificateStatusstringYes

Specifies whether to enable the SSL certificate. Default value: off. Valid values:

  • on : enables the SSL certificate.
  • off: disables the SSL certificate.
on
ServerCertificatestringNo

The content of the SSL certificate. Specify the content of the SSL certificate only if you want to enable the SSL certificate. You can use one of the following methods to obtain the content of the SSL certificate:

  • Method 1: Call the DescribeDomainCertificateInfo API operation to query the information about the SSL certificate corresponding to the accelerated domain name and obtain the public key of the ServerCertificate certificate from the returned data.
  • Method 2: Call the DescribeCdnCertificateList API operation to query the SSL certificate list corresponding to the accelerated domain name, and obtain the value of CertName from the returned data. Then, Call the DescribeCdnCertificateDetail API operation with CertName as a parameter to obtain the details about the certificate, and obtain the public key of the Cert certificate from the returned data.
----BEGIN CERTIFICATE----- MIIFz****-----END CERTIFICATE-----
PrivateKeystringNo

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

----BEGIN RSA PRIVATE KEY-----QswCQ****----END RSA PRIVATE KEY-----
ForceSetstringNo

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.

1

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The ID of the request.

16A96B9A-F203-4EC5-8E43-CB92E68F4CD8

Examples

Sample success responses

JSONformat

{
  "RequestId": "16A96B9A-F203-4EC5-8E43-CB92E68F4CD8"
}

Error codes

HTTP status codeError codeError messageDescription
400InvalidServerCertificateStatus.ValueNotSupportedThe specified ServerCertificateStatus is invalid.-
400SSLPub.MissingParameterThe SSLPub parameter is required.-
400SSLPri.MissingParameterThe SSLPri parameter is required.-
400InvalidSSLPubThe specified SSLPub is invalid.-
400InvalidSSLPriThe specified SSLPri is invalid.-
400Certificate.MissMatchThe SSLPri does not match the certificate.-
400InvalidCertificate.TooLongThe Certificate you provided is over the max lengthCertificate and private key length exceeds the limit
400InvalidCertName.TooLongThe length of the certificate name cannot exceed 128 characters.-
400IllegalOperationDomainYou are not authorized to operate the domain.You are not authorized to manage the domain name.
400AuthenticationFailedError performing verification.-
400SetDomainCertificate.ParameterErrorThe specified parameters are invalid.The specified parameter is invalid.
400Certificate.StatusErrorThe status of the certificate is invalid.-
400DeleteFailedError deleting the certificate.-
400Certificate.NotFindThe certificate does not exist.-
400Certificate.DuplicatedThe certificate name already exists.-
400Certificate.FormatErrorThe format of the certificate is invalid.The specified certificate is invalid.
400Certificate.StatusErrorThe certificate does not exist, or the status of the certificate is invalid.-
400Certificate.KeyNullThe private key is required.-
400Key.MalformedThe specified Key format is invalid.-
400CertStorage.failedError saving the certificate.-
400CertificateContent.DuplicatedThe certificate has been uploaded,do not upload again.-
400Certificate.ExpiredThe certificate has expired.-
400InvalidDomain.notOnlineThe domain is offline. Check the status of the domain and try again later.-
400Decode.ErrorError decoding the SSLPub or SSLPri certificate.-
400sslPub.ErrorError encoding SSLPub.-
400sslPri.ErrorError encoding SSLPri.-
400DomainInSafeModeThe domain is in safe mode. To request permission, contact Customer Service.-
400Certificate.NotPermittedOffTurn off certificate will change domain scheduling, please contact customer service-
400Certificate.SettedNotEffectCertificate was successfully setted but does not take effect for protecting current service, please contact customer service-
400Certificate.NotFindNot find the certificate info.The specified certificate does not exist.
400InvalidSSLPubOrInvalidSSLPriThe SSLPri or SSLPub you provided is malformed.-
400InvalidSSLPubThe SSLPub you provided is malformed.-
400InvalidSSLPriThe SSLPri you provided is malformed.-
400Certificate.MissMatchThe certificate is not match the private key.The certificate and private key do not match.
403DomainInProtectedModeThe domain is in protection mode. To request permission, contact Customer Service.-
404CertName.MissingParameterThe CertName parameter is required.-

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2024-05-07The Error code has changedView Change Details
2023-07-17The API operation is deprecated. The Error code has changedView Change Details
2023-03-22The Error code has changedView Change Details