The data.gov.uk API is provided by CKAN and extensions.
The CKAN API docs are extensive: http://ckan.readthedocs.org/en/release-v2.2.3/
All the action functions return help text detailing parameters etc.
Below are some tips relating to data.gov.uk
A list of datasets: https://data.gov.uk/api/action/package_list
Details of a dataset: https://data.gov.uk/api/action/package_show?id=cabinet-office-energy-use
- “resources” are the Data files/resources and Additional Links.
The parameters to package_search are passed through to SOLR, so consult the SOLR docs for more info.
Free text - the
q parameter works like the data.gov.uk search box and looks for the specified works in title, description etc.. By default, the best matches are returned first. It uses stemming, so ‘fish’ also returns results containing ‘fishes’, ‘fishing’ etc.
By field - use the
fq parameter to filter on particular fields. Returns exact matches. It uses roughly the same syntax as in the URL of the web search.
Further examples are at: Finding Data.
NB Remember to escape these URLs. Most browsers will escape these automatically when you click on these example links, but python clients etc. will mostly need them URL encoded (spaces to
%20 etc). And on the command-line remember to quote the whole URL e.g. use single quotes:
data.gov.uk uses CKAN organizations to store what is shown as “publisher”s on the front-end.
A list of the organizations: https://data.gov.uk/api/action/organization_list
Details of one organization: https://data.gov.uk/api/action/organization_show?id=cabinet-office&include_datasets=false
- “groups” lists the parent group/organization in the hierarchy
You can also get the whole organization tree: https://data.gov.uk/api/action/group_tree?type=organization
And the tree below a particular top-level organization: https://data.gov.uk/api/action/group_tree_section?type=organization&id=department-for-business-innovation-and-skills