Functions

API functions are standard Next.js functions which are placed in the src/pages/api/ folder.

screenshot

A screenshot service, based on WebShot. The service only allows taking screenshot of itself (same host as the request's Host header).

Query parameters

  • path (required): Absolute path of the webpage which should be captured. The host is implied to be the same as the website is running on.
  • deviceScaleFactor (optional): Default is 1, set to a higher number (1.5, or 2) to increase the resolution of the generated image.
  • element (optional): Selector (.class, #id, or element) if you want to capture a particular element on the webpage.
  • download (optional): If set then the server forces the UA to download the image instead of displaying it (via the Content-Disposition: attachment response header). The value of this query parameter becomes the basename. The server appends the correct file extension depending on the image format (eg. .png).

Example


zip

The zip API returns a ZIP with the data (CSV) from the supplied cubes.

The ZIP will include a readme (.txt), as well as two CSV files. One with the full dataset, and one which is filtered (according to countries and startPeriod / endPeriod query params).

Query parameters

  • destinations (required): A comma-separated list of URLs which return a CSV.
  • countries (optional): A comma-separated list of country codes which should be included in the filtered_ dataset.
  • startPeriod / endPeriod (optional): A time range to which the filtered_ dataset should be restricted to.