API中心

正则URL刷新

更新时间:2025-07-28 17:33:54

根据正则url方式清理CDN节点上缓存的文件内容

  • 限制说明:数据格式:请求和响应都仅支持json 使用建议:如果是相同的正则url请等待前一个清理缓存完成后才允许提交。过高的刷新频率会影响内容管理系统的性能。 每日(东八区的时间)使用量:默认500。
  • 单用户调用频率:10/5min
  • 适用产品:内容管理
API鉴权说明详见:API鉴权概览

请求参数

Body 参数

参数名称描述
urlRegularsList
要清理缓存的正则url集合,正则url的格式要求:1)URL 符合正则表达式,输入示例:http://www.a.com/(.*).png。如要推送 http://www.abc.com/test/.*\.txt 正则表达式,在使用接口需要对反斜杠进行转义,即 http://www.abc.com/test/.*\.txt。2)每个正则url所在的域名必须是在我司加速的域名。3)每个正则url最大长度 2000 字符。4)正则url中如果包含特殊字符,需要进行转义,采用utf-8方式转义。5) 相同的正则URL,系统会去重后提交。6)默认500条/天。

返回参数

Body 参数

参数名称描述
CodeString
表示任务创建结果的状态码
MessageString
表示任务提交后,系统的响应消息
itemIdString
调用一次接口并提交任务成功后,将返回一个iteamId,是当次提交任务的唯一标识,通过itemId可批量查询任务的状态(成功/失败)。

错误码

错误代码(code)描述(message)HTTP状态码语义
SuccessTask submitted successfully200任务提交成功
UserNameInvalidUsername is empty or user is not enabled400用户名为空或用户未启用
ParseParameterErrorparse parameter json error400解析json出错
UrlRegularEmptyurl regular must not be empty400正则url表达式不允许为空
OnceSubmitLessThan500you can't submit more than 500 url regulars at a time400一次提交url个数不能超过500个
NumberOutOfLimitthe number of url regular out of today limit(500)400正则url数目总和超过每日上限(500)
NumberOutOfLimitIf the incoming header has a X-Time-Zone, the prompt includes a time interval corresponding to the time zone, such as the number of url regular out of 2018-10-17 01:00:00 GMT+09:00~2018-10-18 00:59: 59GMT+09:00 limit(500)400若传入的头部带时区,那么提示包含对应时区的时间区间,例如 the number of url regular out of 2018-10-17 01:00:00GMT+09:00~2018-10-18 00:59:59GMT+09:00 limit(500)
NumberPartlyOutOfLimitThe regular part of the submitted url exceeds the upper limit. If it is not exceeded, it can be executed normally.400提交的url正则部分超过上限了,未超过的可以正常执行,若传入的头部带时区,那么提示包含对应时区的时间区间,例如 [userName]: url regular can only purge [1] count this time. 2018-10-17 01:00:00GMT+09:00~2018-10-18 00:59:59GMT+09:00 has purge the number of url regular: [2].
RepeatUrlRegularrunning url regular[xxx], please try again after one minute.400正在运行url正则[xxx],请一分钟后再试.
UserNotAllowedPushuser not allowed push400用户不允许推送
ErrorChannelerror channel [xxx,xxx].400错误的频道,(部分错误,正确的正则url仍会执行)
InvalidUrlRegularinvalid url regular [url1,url2].400错误的url,(部分错误,正确的正则url仍会执行)
SystemExceptionsystem exception500系统内部异常

示例

JSON
JSON
请求示例
复制代码 复制成功
#!/bin/bash
username="username_exmaple"
apiKey='apiKey_exmaple'
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/api/content/regular-url/purge" \
-X "POST" \
-u "$username:$password" \
-H "Date:$date" \
-H "Content-Type: application/json" \
-d'{
      "urlRegulars":[
          "http://www.abc.com/test/.*\.txt",
          "http://www.abc.com/test/.*\.png"
       ]   
}'
返回示例
复制代码 复制成功
{
   "Code":Success,
   "Message":"handle success",
   "itemId":"64ec364dd81d4052a3534c1e86167950"
}
本篇文档内容对您是否有帮助?
有帮助
我要反馈
提交成功!非常感谢您的反馈,我们会继续努力做到更好!