CKAN and CMS Integration - ckan/ckan GitHub Wiki

Introduction

There are many different ways to integrate a CMS (such as Drupal) and CKAN as CKAN has a very extensive and customizable API.

Our recommendation is take a fairly loose integration approach, where CKAN and the CMS live “side by side” and both show different parts of the portal.

We recommend this rather than a ‘facade’ or vertical approach in which one application is ‘hidden’ behind the other as this results in a lot of work to reproduce the features of one or the other system – e.g. it is a lot of work to reproduce all the web interface features of CKAN in Drupal and vice versa, even though you have access to rich APIs on either side.

On the other hand, even in a side-by-side integration there is nothing to stop you using the APIs to share information, so you get the best of both worlds.

Webserver

Apache (or any webserver) needs to be set up to route the information to the correct location. An example config file can be seen here, https://gist.github.com/2782349.

(An alternative is subdomaining e.g. running CKAN at datasets.{yoursite} with the CMS at the main domain or running CKAN at the main domain and the CMS at blog.{yoursite}. This can lead to more complexity around authentication).

The only downside of this approach is that both CKAN and Drupal have to share the same theme (or at least main elements). Nonetheless, theme-sharing is generally very straightforward and is far less work than re-implementing all the features of both systems.

Theming

We recommend basing your themes on bootstrap version 2+ (see http://twitter.github.com/bootstrap/), as CKAN already supports this and it gives a great way of sharing your style and layouts.

API Integration

When the two components are calling each other’s JSON APIs, we also recommend using normal web API requests using a e.g. drupal_http_request call or the requests library.

This is slightly lower level than using a specific client library/Drupal module. However, it will definitely give you access to the whole API and will therefore not become out of date. Also, because it is fairly simple to extend the APIs in both systems for your own custom needs, there will never be a client library/module that will support these extensions. There is a proliferation of these integration libraries/modules but we currently do not recommend any of them as all integration cases are somewhat unique.

We also recommend strongly that you use v3 of the CKAN API (http://docs.ckan.org/en/latest/api/index.html) when doing integrations. This gives you many extra features over the previous API versions, makes it easy to do customizations.

This has become the standard way of doing integrations for the CKAN team and is the way it is implemented in both data.gov.uk (by UK government) and the European Commission ODP project (by OKF).