Create Prefetch API
This API is used to prefetch specified URLs to cache content on edge servers in advance, enhancing content delivery 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 unique identifier of the service for which prefetch will be performed. |
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| urls | Array | Mandatory | List of URLs to be prefetched. Each URL must use HTTP or HTTPS protocol. |
Response
Response Body
| Parameter | Type | Description |
|---|---|---|
| batchId | int | The unique identifier of the prefetch batch. |
Status Codes, Error Codes and Error Messages
| Status Code | Error Code | Error Message |
|---|---|---|
| 400 | Request.BadRequest | Bad request. |
| 400 | InvalidCustomer.IdEmpty | Customer ID cannot be empty or invalid. |
| 400 | InvalidService.IdIncorrect | Service ID is empty or invalid. |
| 400 | InvalidService.IdPermission | Service ID cannot be found or unknown. |
| 400 | InvalidService.UrlEmpty | List of URLs cannot be empty. |
| 400 | InvalidPrefetch.BatchSizeOverload | Batch size exceeds limit, please reduce the number of URLs and try again. |
| 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
}