You need to enable JavaScript to run this app.
导航

UploadCertificate

最近更新时间2024.02.29 14:48:18

首次发布时间2022.05.20 22:35:03

API 说明

API 名称:UploadCertificate。
API 域名:open.volcengineapi.com。
API 描述:上传证书。单个账号在每个地域上传证书上限为100个。

使用限制

节流限制:每秒最多提交 40 个 API 请求。

快速调试

URI 参数

在使用该部分 API 提交请求时必须包含以下 URI 参数。

除了 URI 参数,该 API 请求还需要包含签名参数。关于更多签名参数的信息,参见公共请求参数

名称类型是否必选格式说明
Action
string
[a-zA-Z]+
API 名称,如 UploadCertificate。
VersionstringYYYY-MM-DDAPI 版本信息。该参数的取值是 2020-04-01 。
X-Expiresint900表示签名的有效时间,单位是秒,默认值是900。

请求正文

在使用该 API 提交请求时,请求正文中可以包含的参数如下。

参数类型是否必选参数说明示例值
CertificateName

String

证书的名字。具体规则如下:

  • 不能以http://或https://开头。
  • 必须以字母或中文开头,可包含数字、点号(.)、下划线(_)和短横线(-)。
  • 长度限制为1 ~ 128个字符。
  • 不填默认为证书ID。
test
CertificateTypeString证书的类型,支持Server :服务器证书。Server

PublicKey

String

证书公钥,格式如下:
-----BEGIN CERTIFICATE-----
服务器公钥证书(BASE64编码)
-----END CERTIFICATE-----
!!!中间不可有空行!!!
-----BEGIN CERTIFICATE-----
中级签发机构公钥证书(BASE64编码)
-----END CERTIFICATE-----

public

PrivateKey

String

证书私钥,格式如下:

  • 格式1:
    -----BEGIN RSA PRIVATE KEY-----
    证书私钥(BASE64编码)
    -----END RSA PRIVATE KEY-----
  • 格式2:
    -----BEGIN EC PARAMETERS-----
    证书私钥(BASE64编码)
    -----END EC PARAMETERS-----
    -----BEGIN EC PRIVATE KEY-----
    证书私钥(BASE64编码)
    -----END EC PRIVATE KEY-----

private

DescriptionString证书描述。test
ProjectNameString证书所属项目名称。default

响应正文

参数类型参数说明示例值
RequestId
String
请求ID。
20210816110638****2514606306AF947C
CertificateIdString证书ID。cert-*****

示例

请求示例

GET /?Action=UploadCertificate&Version=2020-04-01&CertificateName=\*\*\*&PublicKey=\*\*\*&PrivateKey=\*\*\* HTTP/1.1
Host: open.volcengineapi.com
Region: cn-beijing
ServiceName: alb

响应示例

{
    "ResponseMetadata": {
        "RequestId": "20210816110638****2514606306AF947C",
        "Action": "UploadCertificate",
        "Version": "2020-04-01",
        "Service": "alb",
        "Region": "cn-beijing"
     },
    "Result": {
        "RequestId": "20210816110638****2514606306AF947C",
        "CertificateId": "cert-****"
    }
}

错误码

如果响应正文包含 Error 字段,则表示 API 请求失败。此处仅展示当前 API 的错误码,更多错误码请参见公共错误码

HTTP Code错误码错误信息错误描述
400InvalidCertificateName.MalformedThe specified CertificateName is malformed.指定的 CertificateName 参数格式不合法。
400InvalidDescription.MalformedThe specified Description is malformed.指定的 Description 参数格式不合法。

400

InvalidCertificateType.Malformed

The specified CertificateType is malformed.

指定的 CertificateType 参数格式不合法。

400InvalidPublicKey.MalformedThe specified PublicKey is malformed. The PublicKey's length is too long.指定的 PublicKey 参数格式不合法。公钥长度太长。
400InvalidPublicKey.MalformedThe specified PublicKey is malformed.指定的 PublicKey 参数格式不合法。
400InvalidPrivateKey.MalformedThe specified PrivateKey is malformed.指定的 PrivateKey 参数格式不合法。
400InvalidPublicKey.PrivateKeyMismatchThe specified PublicKey and PrivateKey do not match.指定的公钥和私钥不匹配。

400

OperationFailed.QueryProject

The request on the specified resource failed due to the query on project failed.

因查询项目失败,对于该资源的操作请求失败。

400

QuotaExceed.CertPerRegion

You've reached the limit on the number of server certificates the current region you can create in, usage xx/xx.

已达到当前地域可创建的服务器证书的数量上限。目前已使用xxx,配额为xxx。

400OperationFailed.AddIntoProjectFailedThe request on the specified resource failed due to adding it into the project failed.因将资源加入至项目中失败,对于该资源的操作请求失败。
404InvalidProject.NotFoundThe specified Project does not exist.指定的项目不存在。