文档中心 API文档 修改回源协议接口

修改回源协议接口

更新时间:2022-12-13 11:40:17

适用产品

网页加速、下载分发、动态加速、全站加速、点播分发、直播分发、上传加速、移动加速、上网加速、S-P2P、PCDN、应用性能管理、WEB应用防火墙、BotGuard爬虫管理、WSS、DMS、DDoS云清洗、IPv6一体化解决方案、电商安全加速解决方案、金融安全加速解决方案、政企安全加速解决方案、应用安全解决方案、区块链安全加速解决方案、IPv6安全加速解决方案

接口描述

支持修改回源协议和端口

推荐使用 Open API在线调试

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

请求参数

Path 参数

参数名称类型必填描述
domain-name
String需要查询配置的域名或域名id

Body 参数

参数名称类型必填描述
backToOriginRewriteRule
Object修改回源协议和端口
protocol
String改写后的回源协议,可选值:http、https
port
String改写后的回源端口,若protocol为http时,默认为80,若protocol为https时,默认为443

返回参数

Body 参数

参数名称类型描述
code
String错误代码,当HTTPStatus不为202时出现,表示当前请求调用的错误类型
message
String响应信息,成功时为success
data
String响应数据

错误码

错误代码(code)描述(message)HTTP状态码语义
26939999We encountered an system error. Please try again.500系统内部异常,请稍后重试
26938016This operation requires a body. Ensure that the body is present and the Content-Type header is set.400body内容为空
26938017The body of your HTTP request does not match with the content-type [xml/json].400请求报文与Content-Type描述不一致
26932001The specified domain does not exist.404域名资源项不存在
26932002customer not own domain name[XXX]400域名不属于该客户
26938003The config {0} does not access.400某个配置无法访问
26938005example: 1. No domain was specified. 2.The {0} is invalid.400指定入参格式错误

示例

XML示例
JSON示例
XML示例
请求示例
复制代码 复制成功
#!/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/config/back2originrewrite/123344" \
-X "PUT" \
-u "$username:$password" \
-H "Date: $date" \
-H "Accept: application/xml" \
-H "Content-Type:application/xml" \
-d '<?xml version="1.0" encoding="utf-8"?>
  
<domain>
 <backToOriginRewriteRule>
 <protocol>http</protocol>
 <port>81</port>
</backToOriginRewriteRule>
</domain>'
返回示例
复制代码 复制成功
HTTP/1.1 202 Accepted
Date: Sun, 05 May 2019 09:08:53 GMT
Content-Type: application/xml;charset=utf-8
x-cnc-request-id: 83bbebc7-2c95-47d7
<?xml version="1.0" encoding="UTF-8"?>
<response>
  <code>0</code>
  <message>success</message>
  <data></data>
</response>
本篇文档内容对您是否有帮助?
有帮助
我要反馈
提交成功!非常感谢您的反馈,我们会继续努力做到更好!