Create Prefetch

This API is used to create URL batch prefetch.

1. Request Definition

  • API URL
https://cdn-api.swiftfederation.com/v2.0/services/{serviceId}/prefetches
  • Request Method
POST
  • Request Header

Refer to HTTP Request Headers

  • Request Body

Request Body Data Format: JSON .Every service has its own limits which are checked each time when creating a new request. Every service has limits on number of URLs that can be prefetched in a specific time interval. The default limits: 150 URLs per 5 minutes, 450 URLs per an hour, 1000 URLs per a day. These limits can be changed per service, if you would like that to be done for some service please contact support.

Field Required Type Description
urls Mandatory string[] Array of urls which will be prefetched to edge server.
  • Request Body Example
    {
      "urls": [
          "https://cdn.example1.com/resources/load.js?v=1.2.0",
          "https://cdn.example1.com/resources/load2.js?v=1.2.0",
          "https://cdn.example1.com/resources/load3.js?v=1.2.0"
      ]
    }
    

2. Response Definition

  • Response Header

Refer to HTTP Response Headers

  • Response Body
Field Type Description
batchId int the id of batch prefetch
  • Response Body Example
{
    "batchId": 2
}

The API has limits that will lead to 429 HTTP response if they are hit. The response body in that case will contain a message saying which limit has been hit. Example:

Status: 429 Too Many Requests

{"code": "ratelimit", "message": "10 requests are allowed for one property per 00:01:00, 101 were already made"}
           Updated 2021-10-26 02:57:26

results matching ""

    No results matching ""