为指定的域名申请加速服务
参数名称 | 描述 |
---|---|
*domain-nameString | 需要接入CDN的域名。支持泛域名,以符号“.”开头,如:.example.com,
泛域名也包含多级 a.b.example.com。 如果example.com已备案,那么域名xx.example.com则不需要备案。 |
publish-pointsList | 设置直播推拉流域名的发布点
注意:
1、拉流和对应的推流域名,必须配置相同的发布点;
2、不想修改发布点时,不要传入该节点及以下入参;
3、发布点采用覆盖式更新,每次修改时,需要提交全部发布点,不能仅提交需要修改的部分。 |
uriString | 发布点,支持多个,多个值用||隔开,不传系统默认生成一条发布点uri为“/” |
header-of-clientipString | 传递客户端ip的响应头部,可选值为Cdn-Src-Ip和X-Forwarded-For,默认值为Cdn-Src-Ip |
auto-add-certificateString | 自动创建证书,1-是 |
*versionString | 版本号,当前版本号1.0.0 |
sslObject | ssl证书设置,用于设置加速域名的ssl证书配置。上传证书请使用接口:【新增证书V2】;若要修改证书,请使用接口:【修改证书V2】 |
ssl-certificate-idInteger | 证书ID,新增证书成功后,系统返回的证书ID,use-ssl为true时,才能传ssl-certificate-id。 |
use-sslString | 使用证书,可选值为true和false,true表示使用证书,false表示不使用证书 |
use-for-sniString | 使用sni证书,可选值为true和false,true表示使用sni证书,false表示使用合用证书(暂不支持) |
accelerate-no-chinaString | 是否纯海外加速,入参范围:true、false |
*item-idString | 产品号,如10 |
live-configObject | 直播域名配置,用于设置直播加速域名的推拉流(使用需申请)
注意:该节点下的相关参数配置,除开通API调用权限外,还需要联系专属客服申请开通对应的API客户模板 |
stream-typeString | 直播推拉流类型,可选值为pull和push,pull表示拉流; push表示推流。 |
origin-ipsString | 源站IP,当stream-type为pull时,源站IP和配套推流域名至少一个不为空。
1、如果是推拉流配套,则填写127.0.0.1,不传系统也默认为127.0.0.1
2、如果是直接回源拉流,则填写回源拉流的源站IP |
origin-push-hostString | 配套推流域名,用于设置直播拉流域名对应的推流域名,当stream-type为pull时,源站IP和配套推流域名至少一个不为空;当stream-type为push时,无需传入。 |
*contract-idString | 合同号,如40015677 |
referenced-domain-nameString | 指定参考域名。当使用参考域名来新增域名是,新域名将复用参考域名的配置 |
cname-labelString | 共用一级别名,客户存在较多一级域名共用的需求,因此在接口中引入cname-label标识,即拥有相同cname-label的一组域名,共用一级cname。当加速域名的加速区域、加速类型、资源链是一致的时候,建议使用共用一级别名,相同的业务使用相同一级别名cname。 注意: 1、拥有相同cname-label的域名共用一级cname,且有完全一致的dns覆盖 2、共用一级的约束:配置一致、加速类型一致、证书id一致(如果有证书)、加速区域一致、平台套餐一致 3、多个http域名可共用一级,多个sni https域名可共用一级,多个共享证书域名可共用一级 4、单个域名使用cname-label时,域名可取消加速;多个域名共用一级时,不允许取消加速这些域名 5、支持通过修改cname-label达到修改cname的目的 |
*origin-configObject | 回源策略设置,用于设置加速域名的源站信息和回源策略 |
origin-portString | 回源请求端口,不能为0 |
default-origin-host-headerString | 回源HOST,用于更改回源HTTP请求头中的HOST字段。支持格式为: 域名或ip。
注意:必须符合ip/域名格式规范。如果是域名,则域名每段(点号分隔)长度小于等于62,域名总长度小于等于128。 |
origin-ipsString | 回源地址,可以是IP或域名。 1. IP以分号分隔,支持多个。 2. 域名只能输入一个。IP与域名不能同时输入。 3.限制最大不能超过500个字符长度。 |
commentString | 备注信息,最大限制1000个字符 |
config-form-idString | 配置单模板,特定的使用场景下,如果希望新增的加速域名参照某些指定配置时,可以指定配置单模板,具体使用请咨询对应的客户负责人。 |
参数名称 | 描述 |
---|---|
codeString | 请求结果状态码 |
httpStatusInteger | httpstatus=202; 表示成功调用新增域名接口,可使用header中的x-cnc-request-id查看当前新增域名的部署情况 |
cnameString | 由我司自动生成的服务域名名称,例如:xxxx.cdn30.com |
locationString | 响应信用于访问该域名信息的URL,其中domain-id为我司云平台为该域名生成的唯一标示,其值为字符串。 |
x-cnc-request-idString | 唯一标示的id,用于查询每次请求的任务 (适用全部接口) |
messageString | 响应信息,成功时为success |
错误代码(code) | 描述(message) | HTTP状态码 | 语义 |
---|---|---|---|
MalformedXML | The XML provided is incorrect or incompatible with the rules | 400 | 提供的xml不正确或者不符合规则 |
InternalError | Internal errors such as server exception, data acquisition failure, etc. | 500 | 服务器异常,数据获取失败等内部错误 |
DomainAlreadyExists | The added domain name has already existed. | 409 | 添加的域名已经存在。 |
ConfigError | Invalid domain name | 400 | 域名无效 |
ICPNotFound | The domain name you provided does not have a record number. | 400 | 您提供的域名没有备案号 |
InvalidOrigin | No source ip or source domain name is provided. | 400 | 没有提供回源ip或回源域名。 |
InvalidOrigin | The returned source domain and the accelerated domain name cannot be the same | 400 | 回源域名和加速域名不能相同 |
InvalidOrigin | The source ip/domain name is invalid. | 400 | 回源ip/域名不合法。 |
InvalidOrigin | Returned source ip is repeated | 400 | 回源ip重复 |
CustomizedCnameError | Customer sharing a level 1 error | 409 | 客户共用一级错误 |
ConfigFormNotExists | Configuration does not exist | 400 | 入参服务区域错误 |
CnameError | Shared first level error | 409 | 共用一级错误 |
CnameError | The common level belongs to multiple configuration order templates. | 400 | 共用一级属于多个配置单模板 |
InvalidOrigin | Domain name attribute value is incorrect | 400 | 域名属性值错误 |
InvalidOrigin | No certificate id is passed when using the certificate | 400 | 使用证书时没有传入证书id |
ConfigError | No corresponding service order | 400 | 没有对应的服务单 |
ConfigError | The external acceleration type of the parameter is empty | 400 | 参数的外部加速类型为空 |
ConfigError | Cannot find the configuration list of the domain name | 400 | 找不到域名的配置单 |
ConfigError | Cannot find the service form for the domain name | 400 | 找不到域名的服务单 |
ConfigError | The specified configuration does not match the specified shared primary domain name. | 409 | 指定配置与指定共用一级域名不匹配 |
ConfigError | The specified acceleration type does not match the specified shared first-level domain name. | 400 | 指定加速类型与指定共用一级域名不匹配 |
NoSuchConfigTemplet | The configuration template does not exist. | 404 | 入参服务区域与指定共用一级域名的服务区域不匹配 |
NO_AVAILABLE_CONFIG | Cannot find a suitable ticket based on the type of acceleration | 400 | 配置单模板不存在 |
PARSE_PARAM_ERROR | Input parameter parsing error | 400 | 根据加速类型找不到合适的服务单 |
NULL_DOMAIN_NAME | Domain name is empty | 400 | 入参解析错误 |
STAGING_SUIT_ERROR | Package is not found | 400 | 证书id不能为空 |
SUIT_HAS_NOT_CONFIG_CERTIFICATE_SERVICE | The service order is of the https type, but the related service does not have the relevant secondary service for configuring the certificate. | 400 | 该证书不支持Cipher加密套件的自助配置 |
ERROR_CONFIG_PARAM | Configuring single configuration item error | 400 | 配置单配置项错误 |
MAIN_DOMAIN_NAME_EXIST | Primary domain already exists | 400 | 主域名已存在 |
#!/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://api.cdnetworks.com/cdnw/api/domain" \
-X "POST" \
-u "$username:$password" \
-H "Date: $date" \
-H "Accept: application/json" \
-H "Content-Type:application/json" \
-d '{
"version": "1.0.0",
"domain-name": "www.example.com",
"contract-id": "40012086",
"item-id": "10",
"origin-config":{
"origin-ips":"1.1.1.0"
},
"referenced-domain-name":"aaa.linlytest.com",
"ssl":{
"use-ssl":"true",
"ssl-certificate-id":"certificate ID"
}
}'
HTTP/1.1 202 Accepted
Date: Fri, 17 May 2017 06:33:26 GMT
Content-Type: application/xml;charset=utf-8
x-cnc-request-id:c54cbbb4-19fe-407a-930c-3988b62ed2fd
Location:https://api.cdnetworks.com/api/domain/1234567
cname: 7nt6mrh7sdkslj.cdn30.com
{"message":"success"}