修改高级源配置接口

更新时间:2023-12-15 10:39:48

适用产品

网页加速、下载分发、全站加速、应用安全加速解决方案、IPv6一体化解决方案、电商安全加速解决方案、金融安全加速解决方案、政企安全加速解决方案、应用安全解决方案、区块链安全加速解决方案、IPv6安全加速解决方案、点播分发、直播分发、移动加速

接口描述

通过接口自助修改高级源配置。允许客户指定区域配置,不同的IP回源,以及多源时候,可以指定策略回源。接口url的*可为域名名称或域名id。

  • 调用URL: https://open.chinanetcenter.com/api/basicconfig/advancedsource/*
  • 调用方法:PUT
  • 限制说明:· 加速域名必须已备案完成。 · 加速域名必须不包含如下信息:出售药物和管制刀具类,含有不法言论、信息。 · 视频类加速域名必须有视听许可证;博客论坛或社区类加速域名必须有BBS专项审批资质。 · 接口请求和返回结果接受xml和json格式。

调用频率

单用户调用频率:300/5min

请求参数

Body 参数

XML
参数名称描述
origin-ipString
回源地址,可以是IP或域名。 1、IP以分号分隔,支持多个。 2、域名只能输入一个。IP与域名不能同时输入。 3、限制最大不能超过500个字符长度。
src-portInt
回源请求端口
use-advanced-sourcesString
是否开启高级源配置,此项必填。 true:开启 false:不开启 如果要清空配置可以传入false.
detection-portInt
高级源探测端口,开启高级源时(use-advanced-sources=true)才可配置
advanced-sourcescomplex
高级源配置标签 注意:表示需要设置高级源配置时,此项必填
advanced-sourcecomplex
高级源配置,表示一条高级源。客户可以配置多条高级源内容。
advanced-source-strategiescomplex
高级源扩展配置,可以指定一条高级源配置下多个IP时,访问策略。支持多个,
advanced-source-strategystring
高级源扩展配置,可以指定一条高级源配置下多个IP时一种访问策略,多种策略可以多个参数 使用前需要与技术支持同事确认可选入参 port:用请求端口回源 primary:主源轮询 standby:备源轮询
areascomplex
需要设置高级源的区域。输入值为区域对应的英文值。一定要有一条全球区域的配置,全球输入Global。如果有标签,则此项必填.支持多个。 推荐入参是大洲粒度的,其他粒度的数据存在调整的风险----请慎用 区域可选值,见附表6
areastring
一组区域配置,如果有多个则,参数多个。
adv-ipsstring
一个区域下配置回源IP信息,如果一个区域有多个IP则有多组
adv-ipString
一组IP信息
ipString
回源IP。支持IP或域名;如果是IP支持IPV4和IPv6,值只能一个
priorityint
层级。指定这个回源IP的层级,不输入默认一层
weightint
权重。指定这个回源IP的权重,不输入默认10
source-hoststring
回源host,支持ip和域名,值只支持一个(动态源不支持) (动态源不支持,必须设置use-dynamic-sources=false)
authorization-methodstring
鉴权方式,可选值OSS、TOS、Amazon S3 (动态源不支持,必须设置use-dynamic-sources=false)
use-dynamic-sourcesString
开启动态源,部分配置项不支持动态源 true:开启 false:不开启 清空:网页加速、全站加速默认为开启;其他服务默认为关闭
default-source-hostString
回源请求HOST

返回参数

Body 参数

XML&JSON
参数名称描述
http status codeint
httpstatus=202;   表示成功调用新增域名接口,可使用header中的x-cnc-request-id查看当前新增域名的部署情况
x-cnc-request-idString
唯一标示的id,用于查询每次请求的任务 (适用全部接口)
LocationString
用于访问该域名信息的URL,其中domain-id为该域名生成的唯一标示,其值为字符串。
codeString
错误代码,当HTTPStatus不为202时出现,表示当前请求调用的错误类型
messageString
响应信息,成功时为success

错误码

错误代码(code)描述(message)HTTP状态码语义
InvalidParameterThe value of use-advanced-sources must be true or false.400use-advanced-sources不合法
InvalidParameterThe strategy is invalid.400高级源扩展配置不合法
InvalidParameterThe area is invalid.400area不合法
NoSuchOperatorThe specified operator does not exist.404操作者不存在
NoSuchCustomerThe specified customer name does not exist.404客户名对应客户不存在
NoSuchCustomerThe specified customer id does not exist.404客户id对应客户不存在
NoSuchRequestIDThe specified request id does not exist.404请求id为空
DuplicatedRequestIDThe specified request id already exist.400请求id重复
NoSpecifiedDomainYou must specified domain.400请求的域名为空
NoSuchDomainThe specified domain does not exist.404域名不属于当前客户
DomainNotRestoredThe domain you are trying to cancel has not been restored.409域名已取消加速需要重新启用
InternalErrorWe encountered an internal error. Please try again.500调用UAC接口异常
DuplicatedDomainNameThe specified domain name must be unique.400传入的域名重复
InvalidParameterDomain attribute Origin ip config err.400源ip与加速域名不能一致
InvalidParameterDomain attribute Origin ip config err.400无效的源ip
InvalidParameterDomain attribute Origin ip config err.400源ip重复
ConfigErrorThe config advSrc does not access.400高级源属性未规划
InvalidParameterDomain attribute Origin ip config err.403源ip不可修改
ConfigVersionOutOfDateThe specified version is out of date.409域名指定版本不是最新版本
ForbiddenThe domain is being deleted403域名挂起中
InvalidParameterThe specified use-advanced-sources is invalid.400是否开启高级源配置值不合法
InvalidParameterThe specified use-dynamic-sources is invalid.400是否开启高级源配置值不合法
ForbiddenDisallow to change adv advanced-sources before authorization.403动态源配置未规划无法修改
InvalidParameterThe specified advanced-sources is empty.400高级源至少需要一条配置
InternalErrorWe encountered an internal error. Please try again.500数据库中不存在全球节点
InvalidParameterThe specified areas is empty400区域不可为空
DuplicatedAreaThe specified area must be unique.400指定的区域不可重复
InvalidParameterThe specified strategy is invalid.400高级源扩展配置不合法
InvalidParameterThe specified config adv-ips must not empty .400区域下配置回源IP信息为空
InvalidParameterThe specified ip is empty.400ip值为空
InvalidParameterThe specified ip is invalid.400ip值不合法
DuplicatedIpThe specified ip already exist in advanced-source config.400一条高级源配置中ip不可重复
InvalidParameterThe priority must in [1,5].400层级的有效值为1到5
InvalidParameterThe weight must in [1,99999].400权重的有效值为1到99999
RequiredPriorityValueOneMust contain a priority config value is 1.400至少有一条层级为1的配置
InvalidParameterThe area is invalid.400指定的区域不存在
RequiredGlobalAreaMust contain a area config value is Global.400至少需要一条全球的配置
InternalErrorWe encountered an internal error. Please try again.500系统内部异常
InvalidParameterThe specified source-host was invalid.400source-host的格式错误 ,约束ip(ipv4/ipv6)和域名格式,只输入一个
InvalidParameterThe specified authorization-method was invalid. 400authorizationMethod 参数错误,不在字典advSrcAuthorizationMethod配置的扩展值范围内
InvalidParameterThe specified default-source-host was invalid.400default-source-host的格式错误 ,约束ip(ipv4/ipv6)和域名格式,只输入一个

示例

JSON
XML
JSON2
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/basicconfig/advancedsource/123344" \
-X "PUT" \
-u "$username:$password" \
-H "Date: $date" \
-H "Accept: application/json" \
-H "Content-Type:application/json" \
-d '
{
    "origin-ip":"127.0.1.1;127.0.2.1;127.0.4.1;127.0.5.1",
    "default-source-host":"1.1.1.1",
    "src-port":"80",
    "use-advanced-sources":"true",
    "use-dynamic-sources":"true",
    "advanced-sources":[
        {
            "advanced-source-strategies":[
                "primary",
                "standby"
            ],
            "areas":[
                "Global",
                "Japan"
            ],
            "adv-ips":[
                {
                    "ip":"127.0.1.1",
                    "priority":"1",
                    "weight":"10"
                },
                {
                    "ip":"127.0.2.1",
                    "priority":"2",
                    "weight":"9"
                }
            ]
        },
        {
            "advanced-source-strategies":[
                "standby"
            ],
            "areas":[
                "China"
            ],
            "adv-ips":[
                {
                    "ip":"127.0.4.1",
                    "priority":"1",
                    "weight":"10"
                },
                {
                    "ip":"127.0.5.1",
                    "priority":"2",
                    "weight":"9"
                }
            ]
        }
    ]
}'
返回示例
复制代码 复制成功
HTTP/1.1 202 Accepted
Server: openresty/1.11.2.2
Date: Fri, 24 May 2019 06:08:47 GMT
Content-Type: application/json;charset=utf-8
Content-Length: 31
Connection: keep-alive
App-Name: service_confApi
x-cnc-request-id: 01f0d3ac-d326-44d3

{"message":"success","code":""}
本篇文档内容对您是否有帮助?
有帮助
我要反馈
提交成功!非常感谢您的反馈,我们会继续努力做到更好!