Development Document

Cache Prewarm Download PDF Document

Endpoint

Request URL: cache/prefetch (POST)

Endpoint Domain Name: cdn.api.baishan.com
Endpoint Version: v2

Endpoint Description

Use this API to prepopulate the edge nodes with file cache to protect the origin.

Notice: Each user account can prewarm up to 10,000 URLs per day. The request rate limit is specified in the X- Ratelimit response header, see detail in Response Header section below.

Notice:Prewarm request status will only be kept for a month. Please make sure to record the statuses before the expiration date.

API Parameters

Notice: Please request the API token from your account team.

Request Parameters (POST)

Supported request data formats: form-data, x-www-form-urlencoded, and json.

ParameterData TypeRequirementDescription
urlsarrayRequiredList of URLs or directories that need to be purged. 500 URLs maximum.

Sample Request:

curl -X POST "https://cdn.api.baishan.com/v2/cache/prefetch?token=xxx"\
    -H "Content-Type: application/json"\
    -d '{"urls":["http://aa.qingcdn.com/resources/rewq/images/logo.png","http://aa.qingcdn.com/resources/fgsa/images/username-caret.png","http://bb.qingcdn.com/resources/fdsa/images/bsc-icons.png","http://cc.qingcdn.com/resources/rewq/images/body-bg.jpg"]}'

Sample Response

Json format.

{
    "code": 0, 
    "data": {
        "task_id": "30042313", //The task ID of this prewarm request.url
        "count": 4, //The number of URLs successfully submitted
        
        //err_urls: indicates one of the errors below:
        //1. Mis-formatted URL
        //2. URL contains a hostname that’s not yours
        //3. The target domain or config is no longer active
        "err_urls":["http://xxxx.com/xx","hdsres.."] 
    }
}

Response Header

HTTP/1.0 200 OK
Api-Id:                70945127
Content-Type:          application/json; charset=utf-8
X-Push-Remaining:      96
X-Ratelimit-Grad:      minute  
X-Ratelimit-Limit:     150  
X-Ratelimit-Remaining: 99   
X-Retry-After:         54  
 

HTTP Status Codes

Error CodeDescription
404Bad request URLs.
401Authorization Error: Invalid token or lack of access.
400Bad request parameters.
200Success.
5xxPlease contact your account team.
CopyRight © 2015-2022 BaishanCloud . All Rights Reserved.