CDN加速

文档中心 API文档 域名配置 查询状态码缓存配置

查询状态码缓存配置

更新时间:2021-06-29 18:43:16

适用产品:网页加速、下载加速、全站加速、点播加速、直播加速、移动加速、云存储

接口描述

通过接口自助查询状态码缓存配置

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

请求参数

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

返回参数

XML&JSON
参数名称类型描述
http-code-cache-rulesComplex状态码缓存规则配置,父标签 1.需要设置状态码缓存规则时,此项必填 2.为<http-code-cache-rules/>时清空状态码缓存规则配置
http-code-cache-ruleComplex状态码缓存规则配置,父标签
http-codesComplex配置http状态码,父标签
http-codeInthttp状态码,可配置多个,例 <http-codes> <http-code>400</http-code> <http-code>404</http-code> </http-codes> 支持状态码列表: 204/HTTP_NO_CONTENT 305/HTTP_USE_PROXY 400/HTTP_BAD_REQUEST 403/HTTP_FORBIDDEN 404/HTTP_NOT_FOUND 405/HTTP_METHOD_NOT_ALLOWED 414/HTTP_REQUEST_URI_TOO_LARGE 429/HTTP_TOO_MANY_REQUESTS 500/HTTP_INTERNAL_SERVER_ERROR 501/HTTP_NOT_IMPLEMENTED 502/HTTP_BAD_GATEWAY 503/HTTP_SERVICE_UNAVAILABLE 504/HTTP_GATEWAY_TIMEOUT
cache-ttlInt配置指定的状态码的缓存时间,单位s,0表示不缓存
data-idInt配置多组配置时,具体某组配置的id

错误码

错误代码(code)描述(message)HTTP状态码语义
InvalidParameterNo domain was specified.400没有指定域名
NoSuchDomainThe specified domain does not exist.404域名不存在
CustomerNoOwnDomaincustomer not own domain name[xxx]400客户没有该域名
InvalidParameterNo domain was specified.400没有指定域名
NoSuchDomainThe specified domain does not exist.404域名不存在
CustomerNoOwnDomaincustomer not own domain name[xxx]400客户没有该域名
InvalidParameterNo domain was specified.400没有指定域名
NoSuchDomainThe specified domain does not exist.404域名不存在
CustomerNoOwnDomaincustomer not own domain name[xxx]400客户没有该域名

示例

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/httpcodecache/123344" \
-X "GET" \
-u "$username:$password" \
-H "Date: $date" \
-H "Accept: application/json" \
-H "Content-Type:application/json"
返回示例
复制
HTTP/1.1 200 OK
Date: Sun, 05 May 2019 09:08:53 GMT
Content-Type: application/json;charset=utf-8
x-cnc-request-id:83bbebc7-2c95-47d7
{
"domain-id":"123344",
"domain-name":"www.example.com",
"http-code-cache-rules":[
  {
    "data-id":"1",
    "cache-ttl":"60",
    "http-codes":["404"]
  },
  {
    "data-id":"2",
    "cache-ttl":"30",
    "http-codes":["500","501"]
  }
 ]
}