CKAN Data API

Access resource data via a web API with powerful query support. Further information in the main CKAN Data API and DataStore documentation.

Endpoints »

The Data API builds directly on ElasticSearch, with a resource API endpoint being equivalent to a single index 'type' in ElasticSearch. This means you can directly re-use ElasticSearch client libraries when connecting to the API endpoint.

Base {{ datastore_root }}
Query {{ datastore_root }}/_search
Query example {{ datastore_root }}/_search?size=5&pretty=true
Schema (Mapping) {{ datastore_root }}/_mapping?pretty=true
Querying »
Query example (first 5 results)

{{ datastore_root }}/_search?size=5&pretty=true

Query example (results with 'jones' in title field)

{{ datastore_root }}/_search?q=title:jones&size=5&pretty=true

Schema (Mapping)

{{ datastore_root }}/_mapping?pretty=true

Endpoint (for clients)

{{ datastore_root }}

Example: Javascript

A simple ajax (JSONP) request to the data API using jQuery.

  var data = {
    size: 5 // get 5 results
    q: 'title:jones' // query on the title field for 'jones'
  };
  $.ajax({
    url: '{{ datastore_root }}/_search',
    data: data,
    dataType: 'jsonp',
    success: function(data) {
      alert('Total results found: ' + data.hits.total)
    }
  });
Example: Python
import urllib
url = '{{ datastore_root }}/_search?size=5&q=title:jones'
fileobj = urllib.urlopen(url)
print fileobj.read()