Skip to main content

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

ParameterTypeRequiredDescription
serviceIdIntegerMandatoryThe unique identifier of the service for which prefetch will be performed.

Body Parameters

ParameterTypeRequiredDescription
urlsArrayMandatoryList of URLs to be prefetched. Each URL must use HTTP or HTTPS protocol.

Response

Response Body

ParameterTypeDescription
batchIdintThe unique identifier of the prefetch batch.

Status Codes, Error Codes and Error Messages

Status CodeError CodeError Message
400Request.BadRequestBad request.
400InvalidCustomer.IdEmptyCustomer ID cannot be empty or invalid.
400InvalidService.IdIncorrectService ID is empty or invalid.
400InvalidService.IdPermissionService ID cannot be found or unknown.
400InvalidService.UrlEmptyList of URLs cannot be empty.
400InvalidPrefetch.BatchSizeOverloadBatch size exceeds limit, please reduce the number of URLs and try again.
400InvalidPrefetch.PrefetchUrlFormatURL 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
}