Skip to main content

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

ParameterTypeRequiredDescription
serviceIdIntegerMandatoryThe request ID.

Body Parameters

ParameterTypeRequiredDescription
urlsString[]MandatoryThe urls to prefetch.

Response

Response Body

ParameterTypeDescription
batchIdintthe id of batch prefetch.

Status Codes, Error Codes and Error Messages

Status CodeError CodeError Message
400Request.BadRequestBad request.
400InvalidCustomer.IdEmptyCustomer id can be empty or invalid.
400InvalidService.IdIncorrectService id is empty or invalid.
400ServiceId.IdPermissionServiceId can not be found or unknown.
400InvalidPrefetch.PurgePatternUrl cannot be empty.
400InvalidPrefetch.BatchSizeOverloadBatch size is overloaded, please reduce batch size and try again.
400InvalidPrefetch.PurgePatternUrl cannot be empty.
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
}