Create Prefetch API
This API is used to prefetch specified urls for enhanced performance.
request
Request-Line
POST /cdn/v1.0/services/{serviceId}/prefetches HTTP/1.1
Request Parameters
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| serviceId | Integer | Mandatory | The request ID. |
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| urls | String[] | Mandatory | The urls to prefetch. |
Response
Response Body
| Parameter | Type | Description |
|---|---|---|
| batchId | int | the id of batch prefetch. |
Status Codes, Error Codes and Error Messages
| Status Code | Error Code | Error Message |
|---|---|---|
| 400 | Request.BadRequest | Bad request. |
| 400 | InvalidCustomer.IdEmpty | Customer id can be empty or invalid. |
| 400 | InvalidService.IdIncorrect | Service id is empty or invalid. |
| 400 | ServiceId.IdPermission | ServiceId can not be found or unknown. |
| 400 | InvalidPrefetch.PurgePattern | Url cannot be empty. |
| 400 | InvalidPrefetch.BatchSizeOverload | Batch size is overloaded, please reduce batch size and try again. |
| 400 | InvalidPrefetch.PurgePattern | Url cannot be empty. |
| 400 | InvalidPrefetch_PrefetchUrlFormat | URL format must be 'protocol://hostname/path'. |
Examples
Create Prefetch Control
Request
POST /cdn/v1.0/services/228331/prefetches HTTP/1.1
{
"urls": [
"http://cdn.example1.com/",
"https://cdn.example1.com/resources/load2.js?v=1.2.0",
"https://cdn.example1.com/resources/load3.js?v=1.2.0"
]
}
Successful Response Body
{
"batchId": 661
}