Cefas Data Hub - APIs
All metadata records and published datasets which are published on the Cefas Data Portal (https://data.cefas.co.uk/) are available to access directly using our Application Programming Interfaces (APIs). These can be used as live links to view, download and query data and metadata and are typically used by developers or data scientists working with coding software.
Our APIs are fully documented via https://data-api.cefas.co.uk/index.html
Commonly Used Terms
|Holding||a single metadata record|
|Recordset||a single dataset|
|Holding Id||an internal unique reference number for a metadata record|
|Medin Id||a unique Globally Unique Identifier (GUID) mainly used in external references to a specific metadata record|
|Recordset Id||an internal unique reference number for a specific dataset|
Common Parameters and How to Access Them
Holding Ids for metadata records are included as the first field of the landing page on our data portal and are also the final part of web address.
Recordset Ids for individual datasets are listed next to the dataset title under the data tab of a metadata record.
Some simple examples of API use are given below, the elements in bold should be changed to the those desired for the given Holding / Recordset.
How to list all recordsets for a given metadata record:
Parameters needed = Holding Id
URL version: https://data-api.cefas.co.uk/api/holdings/945/recordsets
Curl version: curl -X GET "https://data-api.cefas.co.uk/api/holdings/945/recordsets" -H "accept: application/json"
How to fetch a specified recordset (can be used as a live link):
Parameters needed = Recordset Id, Number of pages desired, results per page desired
URL version: https://data-api.cefas.co.uk/api/recordsets/3283/data?page=1&resultsPerPage=100000
Curl version: curl -X GET "https://data-api.cefas.co.uk/api/recordsets/3283/data?page=1&resultsPerPage=100000" -H "accept: application/json"
How to download a recordset (only csv format supported currently)
Parameters needed = Recordset Id
URL version: https://data-api.cefas.co.uk/api/export/3283?format=csv
Curl version: curl -X GET "https://data-api.cefas.co.uk/api/export/3283?format=csv" -H "accept: application/json"
Data Use Conditions
All data are available under the terms of the UK Open Government Licence http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/
For specific queries and particular datasets, please contact us at firstname.lastname@example.org