创建CSR

更新时间:2022-12-05 16:56:29

适用产品

证书管理

接口描述

创建CSR

推荐使用 Open API在线调试

Open API在线调试功能提供可视化界面在线调试API、支持生成代码示例、快速检索查看API文档等能力。前往调试

请求参数

Body 参数

参数名称描述
*nameString
csr名称,不能重复
*algorithmString
密钥算法:RSA/EC 二选一
*domainString
主域名
sansList
备份域名列表
countryString
国家地区
stateString
cityString
城市
companyString
公司
departmentString
部门
commentString
备注

返回参数

Body 参数

参数名称描述
codeString
请求结果状态码
messageString
请求结果信息
dataCreateTheCsrResponseData
请求结果数据
idString
新增成功后的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"
     }
}
本篇文档内容对您是否有帮助?
有帮助
我要反馈
提交成功!非常感谢您的反馈,我们会继续努力做到更好!