文档

SetDomainServerCertificate - 设置域名证书

更新时间:
目前该API接口已标记为弃用,推荐使用替代API:Cdn(2018-05-10) - SetCdnDomainSSLCertificate

调用SetDomainServerCertificate设置指定域名下证书信息及证书功能是否启用。

接口说明

说明
  • 单用户调用频率:10 次/秒。
  • 调用方式:POST。
  • 域名业务类型是直播的情况下,设置域名证书可能会引发业务不可用,因此直播域名不允许通过该接口来设置域名证书。
  • 调试

    您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

    授权信息

    下表是API对应的授权信息,可以在RAM权限策略语句的Action元素中使用,用来给RAM用户或RAM角色授予调用此API的权限。具体说明如下:

    • 操作:是指具体的权限点。
    • 访问级别:是指每个操作的访问级别,取值为写入(Write)、读取(Read)或列出(List)。
    • 资源类型:是指操作中支持授权的资源类型。具体说明如下:
      • 对于必选的资源类型,用背景高亮的方式表示。
      • 对于不支持资源级授权的操作,用全部资源表示。
    • 条件关键字:是指云产品自身定义的条件关键字。
    • 关联操作:是指成功执行操作所需要的其他权限。操作者必须同时具备关联操作的权限,操作才能成功。
    操作访问级别资源类型条件关键字关联操作
    cdn:SetDomainServerCertificateWRITE
    • Domain
      acs:cdn:*:{#accountId}:domain/{#DomainName}

    请求参数

    名称类型必填描述示例值
    DomainNamestring

    指定证书所属加速域名,需属于 HTTPS 加速类型。

    仅支持单个域名查询。

    example.com
    CertNamestring

    证书名称,仅支持传单个名称。

    myCert1
    CertTypestring

    证书类型。取值:

    • upload:上传证书。
    • cas:云盾证书。
    说明 当证书类型为 cas 时,PrivateKey 无需传参。
    cas
    ServerCertificateStatusstring

    HTTPS 证书是否启用。取值:

    • on:启用。

    • off(默认):不启用。

    on
    ServerCertificatestring

    安全证书内容,不启用证书则无需输入,配置证书请输入证书内容。可通过以下两种方法获取安全证书内容:

    • 方法一:调用 DescribeDomainCertificateInfo 查询加速域名对应的证书信息,取返回数据中的 ServerCertificate 证书公钥的值。

    • 方法二:先调用 DescribeCdnCertificateList 查询加速域名对应的证书列表,取返回数据中的 CertName 证书名称的值;然后以 CertName 证书名称为请求参数,通过调用 DescribeCdnCertificateDetail 来获取证书详细信,取返回数据中的 Cert 证书公钥值。

    ----BEGIN CERTIFICATE----- MIIFz****-----END CERTIFICATE-----
    PrivateKeystring

    私钥内容,不启用证书则无需输入,配置证书请输入私钥内容。

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

    设置为 1 时,忽略证书名称重复的校验,覆盖原有同名证书信息。

    1

    返回参数

    名称类型描述示例值
    object
    RequestIdstring

    请求 ID。

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

    示例

    正常返回示例

    JSON格式

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

    错误码

    HTTP status code错误码错误信息描述
    400InvalidServerCertificateStatus.ValueNotSupportedThe specified ServerCertificateStatus is invalid.-
    400SSLPub.MissingParameterThe SSLPub parameter is required.SSLPub参数缺失。
    400SSLPri.MissingParameterThe SSLPri parameter is required.SSLPri参数缺失。
    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 length证书和私钥长度超出限制。
    400InvalidCertName.TooLongThe length of the certificate name cannot exceed 128 characters.-
    400IllegalOperationDomainYou are not authorized to operate the domain.您没有权限操作该域名。
    400AuthenticationFailedError performing verification.-
    400SetDomainCertificate.ParameterErrorThe specified parameters are 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.证书格式错误
    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.证书不存在。
    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.证书与私钥不匹配。
    403DomainInProtectedModeThe domain is in protection mode. To request permission, contact Customer Service.-
    404CertName.MissingParameterThe CertName parameter is required.CertName参数缺失。

    访问错误中心查看更多错误码。

    变更历史

    变更时间变更内容概要操作
    2023-07-17OpenAPI 变更为 deprecated,即将下线、OpenAPI 错误码发生变更看变更集
    变更项变更内容
    API 弃用说明(deprecated)OpenAPI 变更为 deprecated,即将下线
    错误码OpenAPI 错误码发生变更
      删除错误码:400
      删除错误码:403
      删除错误码:404
    2023-03-22OpenAPI 错误码发生变更看变更集
    变更项变更内容
    错误码OpenAPI 错误码发生变更
      删除错误码:400
      删除错误码:403
      删除错误码:404
    • 本页导读 (1)
    文档反馈