Home Knowledge base APIs Precache API for large files

IMPORTANT: Large files should be pre-cached using this API, to ensure that nodeboost.io caching nodes do not time out when pass-thru streaming the file from your origin when the file does not yet exist on nodeboost.io.

Access to this API requires the use of an API key. To acquire your API key, do the following:

  1. Login to your nodeboost.io account.
  2. Click the “Settings” menu, then click on “Accounts”.
  3. On the API Key form, enter your password.
  4. Copy your key to a safe place. Do not reveal this key to anyone outside your organization.

You can then use your API key in the “Authorization” header for your HTTP requests to our API.

Unless otherwise specified, all APIs will return a JSON object string in the response body. All API calls must be made using HTTPS.

Pre-cache individual large files in a configuration

API endpoint: /api/control/user/precache/<slug>/[filename]

Where:

slug – the slug for your domain configuration, for example if yourn odeboost.io domain is mysite-t1.nodeboost.io then the slug is “mysite”

filename – the full path of the file you wish to precache.

This API only accepts HTTP POST requests. Calling this API will cause all nodes to precache the content from your origin server. You may check pre-caching status using the Query API. The POST request may contain additional optional data below:

ttl – the time-to-live in seconds for the content. This defaults to 2,592,000 seconds (30 days)

region – the region in which you want the seed node to be located. Valid values for region are:

  • us01 – US west
  • us02 – US central
  • us03 – US east
  • us04 – US south
  • eu – Frankfurt
  • uk – London
  • jp – Japan
  • sg – Singapore

Example

# This will precache /path/file.txt using the default TTL (30 days) 
# and precache it on all regions:
curl -H 'Authorization: Token 1234567890abcdef' -X POST \
    https://control.nodeboost.io/api/control/user/precache/mysite/path/file.txt

# This will precache /path/file.txt using a TTL of 1 hour
# and precache it in hk region:
curl -H 'Authorization: Token 1234567890abcdef' -X POST -d 'ttl=3600&region=hk' \
    https://control.nodeboost.io/api/control/user/precache/mysite/path/file.txt

Important Notes:

We recommend choosing the region that is nearest to your origin server to facilitate faster pre-caching especially for large files. By default, region will be selected at random.

Avoid sending more than one pre-cache request for the same file, this can cause your origin server to become overloaded with requests for the same file.