Preload – add content prefetching

Preloading means caching the content of a designated URL from the source station to the network nodes, to eliminate the waiting time when a user accesses the resource for the first time. Preloading is generally used in scenarios that involve the delivery of large files, where it can effectively improve the user access experience.

You can configure content prefetching (preloading) for individual files or multiple files.

Request

Method Request URI
POST https://restapi.cdn.azure.cn/subscriptions/{subscriptionId}/endpoints/{endpointId}/preloads?apiVersion=1.0

URI parameter

</tr
Parameter name Description
subscriptionId Subscription unique identifier
endpointId Target node unique identifier

Request header

Request header Description
x-azurecdn-request-date Required. Enter the current UTC request time in yyyy-MM-dd hh:mm:ss format.
Authorization Required. Refer to CDN API signing mechanism for authorization headers.
content-type Required. application/json

Request body

To add content prefetching, you must specify the parameters. An example JSON file is provided below:

{
  "Files": [
    "http://example.com/pictures/city.png"
  ]
}
Parameter name Description
Files The paths for refreshing the file list must be absolute paths, e.g. http://example.com/pictures/city.png

Response

A response comprises a status code, response headers, and a response body.

Status code

Status code Description
202 Indicates that the server has successfully accepted the request.
Other General response indicating that an error has occurred.

Response header

Response header Description
X-Correlation-Id The request’s unique identifier, which is used to track request information.

Response body

An example JSON file for request succeeded is provided here:

{
  "Succeeded": true,
  "IsAsync": true,
  "AsyncInfo": {
    "TaskTrackId": "b520c544-ec34-4ac4-86f5-5394363919c3",
    "TaskStatus": "Processing"
  }
}
Parameter name Description
TaskTrackId Prefetch operation unique identifier, can be used to query prefetch progress
TaskStatus Task status
  • NotSet: State not set
  • Processing: Currently processing
  • Succeeded: Succeeded
  • Failed: Failed

JSON example for request failed:

{
  "Succeeded": false,
  "ErrorInfo": {
    "Type": "MissingAuthorizationHeader",
    "Message": "Missing authorization header."
  }
}
Parameter name Description
Type Error type
  • CredentialInvalid: Invalid credentials
  • ParameterMissing: Parameter missing
  • ParameterInvalid: Invalid parameter
  • MissingAuthorizationHeader: Authorization header missing
  • InvalidRequestDateHeader: Invalid request date header
  • MissingRequestDateHeader: Missing request date header
  • AuthorizationHeaderExpired: Authorization header expired
  • InvalidAuthorizationHeader: Invalid authorization header
  • ApiKeyNotFound: API key not found
  • InvalidApiKey: Invalid API key
  • WrongSignature: Wrong signature
  • SubscriptionNotFound: Subscription does not exist
  • EndpointDoesNotBelongToSubscription: Endpoint does not belong to subscription
  • EndpointNotInActiveState: Endpoint not in active state
  • EndpointNotFound: Endpoint does not exist
  • MaliciousItemPathDetected: Malicious item path detected
  • PermissionDenied: Insufficient permissions
  • RequestThrottled: Request throttled

Message Error information