创建SSL证书 - CreateCertificateV2
功能介绍
创建SSL证书。
调用方法
请参见如何调用API。
授权信息
账号具备所有API的调用权限,如果使用账号下的IAM用户调用当前API,该IAM用户需具备调用API所需的权限。
- 如果使用角色与策略授权,具体权限要求请参见权限和授权项。
- 如果使用身份策略授权,需具备如下身份策略权限。
授权项
访问级别
资源类型(*为必须)
条件键
别名
依赖的授权项
apig:certificate:create
Write
instance
g:ResourceTag/<tag-key>
-
apig:instance:get
请求参数
参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
X-Auth-Token | 是 | String | 用户Token。通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 |
参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
name | 是 | String | 证书名称。支持中文,英文字母,数字,下划线,且只能以英文或汉字开头,4~50个字符。 说明: 中文字符必须为UTF-8或者unicode编码。 |
cert_content | 是 | String | 证书内容 |
private_key | 是 | String | 证书私钥 |
type | 否 | String | 证书类型。
缺省值:global |
instance_id | 否 | String | 所属实例ID,当type=instance时必填 |
trusted_root_ca | 否 | String | 信任的根证书CA |
algorithm_type | 否 | String | 证书算法类型:
|
cert_content_sign | 否 | String | 签名类型证书内容,仅algorithm_type=SM2时必填。 最大长度:8092 |
private_key_sign | 否 | String | 签名类型私钥内容,仅algorithm_type=SM2时必填。 最大长度:8092 |
响应参数
状态码:200
参数 | 参数类型 | 描述 |
|---|---|---|
id | String | 证书ID |
name | String | 证书名称 |
type | String | 证书类型
|
instance_id | String | 实例编码
|
project_id | String | 租户项目编号 |
common_name | String | 域名 |
san | Array of strings | san扩展域名 |
not_after | String | 有效期到 |
signature_algorithm | String | 签名算法 |
create_time | String | 创建时间 |
update_time | String | 更新时间 |
is_has_trusted_root_ca | Boolean | 是否存在信任的根证书CA。当绑定证书存在trusted_root_ca时为true。 缺省值:false |
algorithm_type | String | 证书算法类型:
|
version | Integer | 版本 |
organization | Array of strings | 公司、组织 |
organizational_unit | Array of strings | 部门 |
locality | Array of strings | 城市 |
state | Array of strings | 省份 |
country | Array of strings | 国家 |
not_before | String | 有效期从 |
serial_number | String | 序列号 |
issuer | Array of strings | 颁发者 |
状态码:400
参数 | 参数类型 | 描述 |
|---|---|---|
error_code | String | 错误码 |
error_msg | String | 错误描述 |
状态码:401
参数 | 参数类型 | 描述 |
|---|---|---|
error_code | String | 错误码 |
error_msg | String | 错误描述 |
状态码:403
参数 | 参数类型 | 描述 |
|---|---|---|
error_code | String | 错误码 |
error_msg | String | 错误描述 |
状态码:404
参数 | 参数类型 | 描述 |
|---|---|---|
error_code | String | 错误码 |
error_msg | String | 错误描述 |
状态码:500
参数 | 参数类型 | 描述 |
|---|---|---|
error_code | String | 错误码 |
error_msg | String | 错误描述 |
请求示例
创建一个ssl证书
{
"name" : "cert_demo",
"private_key" : "'-----BEGIN PRIVATE KEY-----THIS IS YOUR PRIVATE KEY-----END PRIVATE KEY-----\\n'",
"cert_content" : "'-----BEGIN CERTIFICATE-----THIS IS YOUR CERT CONTENT-----END CERTIFICATE-----\\n'",
"type" : "instance",
"instance_id" : "f0fa1789-3b76-433b-a787-9892951c620e"
} 响应示例
状态码:200
OK
{
"id" : "a27be832f2e9441c8127fe48e3b5ac67",
"name" : "cert_demo",
"common_name" : "apigtest.example.com",
"san" : [ "apigtest.example.com", "*.san.com" ],
"version" : 3,
"organization" : [ "XX" ],
"organizational_unit" : [ "IT" ],
"locality" : [ "XX" ],
"state" : [ "XX" ],
"country" : [ "XX" ],
"not_before" : "2019-06-01T00:00:00Z",
"not_after" : "2031-08-16T06:36:13Z",
"serial_number" : "13010",
"issuer" : [ "XXSSL Inc" ],
"signature_algorithm" : "SHA256-RSA",
"create_time" : "2021-08-20T02:03:53Z",
"update_time" : "2021-08-20T02:03:53Z",
"algorithm_type" : "RSA"
} 状态码:400
Bad Request
{
"error_code" : "APIG.3325",
"error_msg" : "The API quota name already exists"
} 状态码:401
Unauthorized
{
"error_code" : "APIG.1002",
"error_msg" : "Incorrect token or token resolution failed"
} 状态码:403
Forbidden
{
"error_code" : "APIG.1005",
"error_msg" : "No permissions to request this method"
} 状态码:404
Not Found
{
"error_code" : "APIG.3030",
"error_msg" : "The instance does not exist;id:f0fa1789-3b76-433b-a787-9892951c620ec"
} 状态码:500
Internal Server Error
{
"error_code" : "APIG.9999",
"error_msg" : "System error"
} 状态码
状态码 | 描述 |
|---|---|
200 | OK |
400 | Bad Request |
401 | Unauthorized |
403 | Forbidden |
404 | Not Found |
500 | Internal Server Error |
错误码
请参见错误码。

