Extension Api-Tracking


Extension Basics

Title
Api-Tracking
Name
ckanext-api-tracking
Type
Core extension
Description
CKAN extension for API tracking.
CKAN versions

~2.10, ~2.11

Show details
Download-Url (zip)
Last commit
21 days ago (2025-12-31 18:00:22)
Url to repo
Category
Authentication & Security


Background Infos

Description (long)
Show details

Tests CKAN 2.10 Tests CKAN 2.11 This repository contains a CKAN open-source extension that can be added to any CKAN 2.10+ instance. It was developed by Norwegian Refugee Council (NRC) and Open Knowledge Foundation (OKFN).

CKAN API tracking extension

This extension allows CKAN portals to monitor the use of API tokens by users or service accounts.

Use-cases

NRC uses this extension in the following way:

  • Track API usage by dataset and organization.
  • Track API usage by users.
  • Track API usage by API token.

How it works

This extension adds a new middleware to the CKAN application that intercept all API requests and log them into the CKAN database. A new database table was created to store this information. This table is similar to the current CKAN tracking_raw table (in use at the TrackingMiddleware). Considering the similarities with the CKAN core feature, a possible future for this extension is to capture all calls and unify usage tracking.

This extension also includes a series of dashboards with a summary of the available data. These dashboards are based on the CKAN core StatsPlugin plugin. This extension eventually will attempt to replace the current stats plugin.

All data from this extension is only accessible by sysadmins.

See tracking_type.md for more information on the tracking fields.

Sample screenshots

Token usage by name Token usage by dataset Latest Token usage

API endpoints

  • all_token_usage: `/a
Version
0.5.1
Version release date
2025-03-05
Contact name
Norwegian Refugee Council (NRC) and Open Knowledge Foundation (OKFN).
Contakt email
(not set)
Contact Url
(not set)


Installation Guide

Configuration hints

To install ckanext-api-tracking:

Install the package:

pip install -e "git+https://github.com/NorwegianRefugeeCouncil/ckanext-api-tracking.git@main#egg=ckanext-api-tracking"
pip install -r https://raw.githubusercontent.com/NorwegianRefugeeCouncil/ckanext-api-tracking/main/requirements.txt

or clone the source and install it on the virtualenv

git clone https://github.com/NorwegianRefugeeCouncil/ckanext-api-tracking.git
cd ckanext-api-tracking
pip install -e .
pip install -r
Plugins to configure (ckan.ini)
api_tracking
CKAN Settings (ckan.ini)
# ckanext.api_tracking.track_login = true  # default is false
# ckanext.api_tracking.track_logout = true # default is false
DB migration to be executed
(not set)
<< back to Extensions