刷新缓存
更新时间:2023-11-22
接口描述
本接口用于刷新已经缓存的资源,支持批量提交,一次最多提交1000个url,24小时之内最多提交20000个url的刷新请求或者200个目录的刷新请求。
请求结构
                Plain Text
                
            
            1POST /v2/cache/purge HTTP/1.1
2Host: cdn.baidubce.com
3Authorization: authorization string
4
5{
6    "tasks":[
7        {
8            "url":"http://test1.baidu.com/xxx",
9            "type":"file"
10        },
11        {
12            "url":"http://test2.baidu.com/xxx/",
13            "type":"directory"
14        }
15    ]
16}请求头域
除公共头域外,无其它特殊头域。
请求参数
RequestBody参数
| 参数名称 | 类型 | 是否必选 | 描述 | 
|---|---|---|---|
| tasks | list<PurgeTask> | 是 | 提交的刷新任务列表详情。 | 
PurgeTask类型说明:
| 参数名称 | 类型 | 是否必选 | 描述 | 
|---|---|---|---|
| url | string | 是 | 表示需要刷新的url,如果type为directory,必须以/结尾。 | 
| type | string | 否 | 可选值为file、directory,默认为file。 | 
响应头域
除公共头域外,无其它特殊头域。
响应参数
响应码
| HTTP Status Code | 描述 | 
|---|---|
| 201 | 成功 | 
响应体
| 参数名称 | 类型 | 描述 | 
|---|---|---|
| id | string | 提交刷新任务后生成的id,可用于查询任务状态。 | 
请求示例
                JSON
                
            
            1POST /v2/cache/purge HTTP/1.1
2Host: cdn.baidubce.com
3Content-Type: text/json;utf-8
4
5{
6    "tasks":
7    [
8        {
9            "url":"http://my.domain.com/path/to/purge/1.data"
10        },
11        {
12            "url":"http://my.domain.com/path/to/purege/dir/",
13            "type":"directory"
14        }
15    ]
16}响应示例
                JSON
                
            
            1HTTP/1.1 201 Created
2Content-Type: application/json;utf-8
3x-bce-request-id: 81d0b05f-5ad4-1f22-8068-d5c9de60a1d7
4Server: BCE-CDN
5
6{
7    "id": "5fea77560ea4451aa703a558b933e274"
8}