CDN加速

创建CSR

更新时间:2021-04-01 16:14:42
适用产品:通用功能

接口描述

创建CSR

请求参数

参数名称类型必填描述
namestringcsr名称,不能重复
algorithmstring密钥算法:RSA/EC 二选一
domainstring主域名
sansarray备份域名列表
countrystring国家地区
statestring
citystring城市
companystring公司
departmentstring部门
commentstring备注

返回参数

参数名称类型描述
codestring请求结果状态码
messagestring请求结果信息
dataComplex请求结果数据
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主域名未指定
0success202请求成功
26939999We encountered an internal error. Please try again.500系统发生错误
26938018The accept header specified in your request is not acceptable.406Accept请求头不支持,接口仅支持json和xml格式,默认为json格式
0success202请求成功
26939999We encountered an internal error. Please try again.500系统发生错误
26938018The accept header specified in your request is not acceptable.406Accept请求头不支持,接口仅支持json和xml格式,默认为json格式
0success202请求成功
26939999We encountered an internal error. Please try again.500系统发生错误
26938018The accept header specified in your request is not acceptable.406Accept请求头不支持,接口仅支持json和xml格式,默认为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"
     }
}