CKAN connect is a Drupal 8/9 companion module for the Data Visualisation Framework (DVF) module. Its goal is to provide CKAN connectivity and abstract API calls. Other modules can use CKAN connect if they need CKAN connectivity from Drupal and it does not require DVF to function.
CKAN is the industry standard for large dataset storage and is used by most governments for public data storage. It provides a robust API for retrieving data records with support for filtering, searching and more.
Examples of CKAN instances:
Install and configure
Install
CKAN connect is ideally installed via composer
composer require drupal/ckan_connect
Then enabled via Drupal UI or drush
drush en ckan_connect
Configure
Once installed you must set the Base URL for the CKAN instance.
- Visit: Admin > Configuration > Webservices > CKAN Connect (/admin/config/services/ckan-connect)
- Set the API url to match your CKAN instance eg.
https://data.gov.au/api/3 - If you need write access to CKAN or you need to view private datasets then you can also add an API key. Note the security implications here, you could potentially expose private data on your Drupal site when an API key is used
CKAN Connect API
Add as dependency
If your module requires CKAN Connect, ensure dependencies are added
composer.json
"require": {
"drupal/ckan_connect": "*"
}
module.info.yml
dependencies:
- ckan_connect:ckan_connect
Usage
The CkanClientInterface documents available methods, but most of the time you will only need the get() method. This will make an API call to a specific endpoint with the appropriate query parameters added.
Example of querying the action/datastore_search endpoint:
use Drupal\ckan_connect\Client\CkanClientInterface;
$client = new CkanClientInterface();
$response = $client->get('action/datastore_search', [
'id' => 'da675507-10b5-4825-8e79-09dcbb577ece',
'limit' => 10,
'offset' => 0,
]);
if ($response->success === TRUE) {
var_dump($response->result);
}
View the CKAN API docs for more information on available endpoints and query parameters.
Issues and feature suggestions
We welcome (and appreciate) improvements and fixes to CKAN Connect, so if you have something to add please submit an issue in the issue queue of the module.
Project information
- Project categories: Integrations
17 sites report using this module
- Created by jorgegc on , updated
Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.





