Java client library for interacting with CKAN
Switch branches/tags
Nothing to show
Clone or download
nigelbabu Merge pull request #4 from rossjones/patch-1
Updated to point at more useful library
Latest commit 5895372 Nov 17, 2015

This library is for old version of CKAN.

It is suggested that you instead use Jackan or read more on the Project Page


A work in progress

Provides an interface to a CKAN 1.7 installation.

An ant build.xml file is provided with the source code, and the following tasks are implemented:

Install Dependencies

Run the following to install dependencies (gson 2.2 and junit 4.10 and apache.httpclient 4.1.3) locally

ant deps

Generate documentation

Documentation is generated in the docs folder.

ant docs

Run tests



A simple example of using the API is show below, this particular one will search for all 'gold' related datasets on and display information about the resources attached to each one.

    public void test_Example() {
        // Create a new client with a connection to, on the default
        // port and with no api key required.
        Client client = new Client( new Connection(""), "");

        try {
            // Get the search results for the word gold
            Dataset.SearchResults search_results = client.findDatasets("gold");
            for (Dataset dataset : search_results.results ) {
                int count = 0;

                System.out.println("Adding resources from " + dataset.getTitle() + "\n");
                for (Resource resource : dataset.getResources() ) {
                    count = count + 1;
                    System.out.println( " " + count + ". "  + resource.getName() );
                    System.out.println( "    Format: "      + resource.getFormat() );
                    System.out.println( "    Mimetype: "    + resource.getMimetype() );
                    System.out.println( "    Description: " + resource.getDescription() );
                    System.out.println( "    URL: "         + resource.getUrl() + "\n");
        } catch ( CKANException e ) {

Which with the current data should show:

Adding resources from Gold Prices in London 1950-2008 (Monthly)

 1. CSV
    Format: csv
    Mimetype: text/plain
    Description: CSV file extracted and cleaned from source excel

Adding resources from Gold & Silver Mines Energy Use & GHG Emissions 

   1. null
      Format: XLS
      Mimetype: null
      Description: Gold and Silver Mines Secondary Energy Use and GHG Emissions

   2. null
      Format: html
      Mimetype: null

Adding resources from Open Economics Data Store

   1. null
      Format: index/html
      Mimetype: null
      Description: Data store index page
      URL: package-type.catalog

Adding resources from Standard and Poor's (S&P) 500 Monthly Market Data including Price, Dividend, Earnings and P/E Ratio

   1. standard-and-poors-500-shiller.webstore.csv
      Format: csv
      Mimetype: text/csv
      Description: Webstore version of file (cleaned up and normalized)

   2. irrational_exuberance_data.xls
      Format: xls
      Mimetype: application/
      Description: Source excel file on Robert Shiller's website (updated monthly)

   3. git-repo
      Format: git
      Mimetype: null
      Description: Source repo with relevant scripts.


  • Non-dataset/group/resource objects