Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: Download Tracker 1.0.7 — Minor update available for module download_tracker (1.0.7). Release: Directory2Block Slideshow 1.0.8 — Minor update available for module directory2block_slideshow (1.0.8). Release: Mautic Audiences 1.1.5 — Minor update available for module mautic_audiences (1.1.5). Release: Rightup theme 1.0.3 — Minor update available for theme vartheme_bs5_rightup (1.0.3). Release: CommentOn 1.0.6 — Minor update available for module commenton (1.0.6). Release: ChatGPT Ads 1.0.3 — Minor update available for module chatgpt_ads (1.0.3). Release: RightUp 1.0.2 — Minor update available for module rightup (1.0.2). Release: CronWatch 0.12.1 — Minor update available for module cronwatch (0.12.1). Module Revived: Swagger-PHP OpenAPI 3 documentation generator 1.0.0 — Module swagger_php updated after 10 months of inactivity (1.0.0). Security Coverage: Microsoft Azure AI — Module ai_provider_azure now has official Drupal security advisory coverage.

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.

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
2
Tracked since
Dec 2023
Latest release
2 years ago
Releases (12 mo)
0
Maintenance
Dormant

Releases

Version Type Core Release date
3.0.0 Stable Dec 13, 2023
3.x-dev Dev Dec 13, 2023