百度智能云

All Product Document

          CDN

          Refresh Cache

          This interface is used to clear cached files, and it supports to submit all. You can submit 1,000 URLs at most at one time, and you can submit 20,000 URL purge requests or 200 directory purge requests at most within 24 hours.

          Method Path Description
          POST /v2/cache/purge Submit purge tasks

          Request body

          Parameter Optional Type Description
          tasks Required list type, PurgeTask content items are explained as follows:
          - url: Required, String type, indicate the URL to purge. If the type is directory, it shall end with /.
          - type: Optional, String type, you can select file/directory, and the default is file.
          Details of the purge task list submitted

          Response code (Http Status Code)

          HTTP Status Code Description
          201 Success

          Response body

          Parameter Type Description
          id String Id of the Purge task, you can use it to query task status.

          Request example

          POST /v2/cache/purge HTTP/1.1 
          Host: cdn.baidubce.com 
          Content-Length: 145
          Content-Type: text/json;utf-8
          
          { 
              "tasks": 
              [ 
                  { 
                      "url":"http://my.domain.com/path/to/purge/1.data" 
                  }, 
                  { 
                      "url":"http://my.domain.com/path/to/purege/dir/", 
                      "type":"directory" 
                  } 
              ] 
          } 

          Response example

          HTTP/1.1 201 Created 
          Content-Length: 91
          Content-Type: application/json;utf-8
          x-bce-request-id: 81d0b05f-5ad4-1f22-8068-d5c9de60a1d7
          Server: BCE-CDN 
          { 
              "id": "5fea77560ea4451aa703a558b933e274" 
          }
          Previous
          Operation Record
          Next
          Query Limit