API access for file datasets (not linked data)

Most of the datasets hosted on statistics.gov.scot are published as linked open data. This means that they can be filtered and extracts downloaded using the tools within our website. They can be accessed programmatically using our SPARQL API, which you can read more detail about in our guide.

For a small number of datasets, we publish simple flat files or zipped collections of files. For example, see the “Supply, Use and Input-Output Tables” dataset.

For these datasets, metadata only can be queried as normal using the SPARQL API. The dataset itself is presented as either a simple file or zipped collection of files for download. 

When updated, each new version of the dataset will be assigned a new download URL. Downloading the dataset directly from the browser will always yield the most up-to-date version of the dataset. If you are making use of API access to the data, it is essential to first extract the current download URL from the metadata. This will ensure that you access the latest version of the data, and the process of extracting the URL from metadata can itself be automated.

You can see example code showing how to do this, using, R on GitHub.