Request URL: cache/prefetch (POST)
Endpoint Domain Name:
cdn.api.baishan.com
Endpoint Version:v2
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.
Notice: Please request the API token from your account team.
Supported request data formats: form-data, x-www-form-urlencoded, and json.
Parameter | Data Type | Requirement | Description |
---|---|---|---|
urls | array | Required | List of URLs or directories that need to be purged. 500 URLs maximum. |
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"]}'
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.."]
}
}
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
Error Code | Description |
---|---|
404 | Bad request URLs. |
401 | Authorization Error: Invalid token or lack of access. |
400 | Bad request parameters. |
200 | Success. |
5xx | Please contact your account team. |