创建CSR

更新时间:2022-04-19 11:44:24

适用产品

证书管理

接口描述

创建CSR

请求参数

Body 参数

JSON
参数名称类型必填描述
name
stringcsr名称,不能重复
algorithm
string密钥算法:RSA/EC 二选一
domain
string主域名
sans
array备份域名列表
country
string国家地区
state
string
city
string城市
company
string公司
department
string部门
comment
string备注

返回参数

Body 参数

JSON
参数名称类型描述
code
string请求结果状态码
message
string请求结果信息
data
Complex请求结果数据
id
string新增成功后的csr id ,“data”节点的子节点

错误码

错误代码(code)描述(message)HTTP状态码语义
0success202请求成功
26939999We encountered an internal error. Please try again.500系统发生错误
26938018The accept header specified in your request is not acceptable.406Accept请求头不支持,接口仅支持json和xml格式,默认为json格式
26938005No name was specified.400未指定csr名称
26938005No algorithm was specified.400未指定密钥算法
26938005No domain was specified.400主域名未指定

示例

JSON
JSON
请求示例
复制代码 复制成功
#!/bin/bash
username="example_username"
apiKey="example_apiKey"
date=`env LANG="en_US.UTF-8" date -u "+%a, %d %b %Y %H:%M:%S GMT"`
password=`echo -en "$date" | openssl dgst -sha1 -hmac $apiKey -binary | openssl enc -base64`
curl -i --url "https://open.chinanetcenter.com/api/csr-manage/csr" \
-X "POST" \
-u "$username:$password" \
-H "Date: $date" \
-H "Accept: application/json" \
-H "Content-Type:application/json" \
-d '{
	"name": "csr test1",
	"algorithm": "RSA",
	"domain": "www.123.com",
	"sans": [
		"aaa.com",
		"bbb.com"
	],
	"comment": "123",
	"country": "CN",
	"state": "FJ",
	"city": "xiamen",
	"company": "wangsu",
	"department": "cdn department"
}'
返回示例
复制代码 复制成功
HTTP/1.1 202 Accepted
Date: Sun, 05 May 2019 09:08:53 GMT
Content-Type: application/json;charset=utf-8
x-cnc-request-id: 83bbebc7-2c95-47d7
{
  "code": "0",
  "message": "success",
  "data" : {
       "id":"91"
     }
}
本篇文档内容对您是否有帮助?
有帮助
没帮助
提交成功!非常感谢您的反馈,我们会继续努力做到更好!