Skip to main content

Download a data set as CSV

The CSV response will render its metadata in a human-readable format (instead of machine-readable IDs). The CSV is not subject to the same backward compatibility guarantees as the data set’s JSON representation in other endpoints.

The URL for this endpoint is:

GET https://dev.statistics.api.education.gov.uk/api/v{version}/data-sets/{dataSetId}/csv

Parameters

Path parameters

The following parameters will need to be substituted into the URL path.

Parameter Type Required Description
dataSetId string true

The ID of the data set.

version string true

The requested API version

Defaults to: 1.0

Query parameters

Parameter Type Required Description
dataSetVersion string false

The version of the data set to use e.g. 2.0, 1.1, etc.

Example request

To illustrate how to use this API endpoint, we have provided some samples below in various languages.

cURL

curl -X GET https://dev.statistics.api.education.gov.uk/api/v{version}/data-sets/{dataSetId}/csv

JavaScript

const url = 'https://dev.statistics.api.education.gov.uk/api/v{version}/data-sets/{dataSetId}/csv';

const response = await fetch(url, {
  method: 'GET',
});

console.log(response.json());

Python

import requests

url = 'https://dev.statistics.api.education.gov.uk/api/v{version}/data-sets/{dataSetId}/csv'

response = requests.get(url)

print(response.text)

R

library(httr)

url <- "https://dev.statistics.api.education.gov.uk/api/v{version}/data-sets/{dataSetId}/csv"

response <- GET(url)

output <- content(response)

Responses

Status Description Media Type Schema
200

The data set CSV file.

text/csv string
403

Forbidden

application/json ProblemDetailsViewModel
404

Not Found

application/json ProblemDetailsViewModel

Example successful response