CKAN API Documentation Guide
CKAN API Documentation Guide
API guide
This section documents CKAN’s API, for developers who want to write code that interacts with CKAN sites and their
data.
CKAN’s Action API is a powerful, RPC-style API that exposes all of CKAN’s core features to API clients. All of a
CKAN website’s core functionality (everything you can do with the web interface and more) can be used by external
code that calls the CKAN API. For example, using the CKAN API your app can:
• Get JSON-formatted lists of a site’s datasets, groups or other CKAN objects:
[Link]
[Link]
[Link]
• Get a full JSON representation of a dataset, resource or other object:
[Link]
[Link]
[Link]
• Search for packages or resources matching a query:
[Link]
[Link]
• Create, update and delete datasets, resources and other objects
• Get an activity stream of recently changed datasets on a site:
[Link]
Note: CKAN’s FileStore and DataStore have their own APIs, see:
• FileStore and file uploads
• DataStore extension
153
CKAN documentation, Release 2.9.4
Warning: The legacy APIs documented in this section are provided for backwards-compatibility, but support for
new CKAN features will not be added to these APIs. These endpoints will be removed in the future.
Note: The REST API was deprecated in CKAN v2.0 and removed starting from CKAN v2.8.
Search resources are available at published locations. They are represented with a variety of data formats. Each
resource location supports a number of methods.
The data formats of the requests and the responses are defined below.
Search Resources
See below for more information about dataset and revision search parameters.
Search Methods
It is also possible to supply the search parameters in the URL of a GET request, for example /api/search/
dataset?q=geodata&allfields=1.
Search Formats
Name Format
Dataset-Search-Params Resource- { Param-Key: Param-Value, Param-Key: Param-Value, . . . } See below
Search-Params Revision-Search- for full details of search parameters across the various domain objects.
Params
Dataset-Search-Response { count: Count-int, results: [Dataset, Dataset, . . . ] }
Resource-Search-Response { count: Count-int, results: [Resource, Resource, . . . ] }
Revision-List [ Revision-Id, Revision-Id, Revision-Id, . . . ] NB: Ordered with youngest
revision first. NB: Limited to 50 results at a time.
Tag-Count-List [ [Name-String, Integer], [Name-String, Integer], . . . ]
Dataset Parameters
Note: filter_by_openness and filter_by_downloadable were dropped from CKAN version 1.5 onwards.
Note: Only public datasets can be accessed via the legacy search API, regardless of the provided authorization. If
you need to access private datasets via the API you will need to use the package_search method of the API guide.
Resource Parameters
Note: Powerful searching from the command-line can be achieved with curl and the qjson parameter. In this case you
need to remember to escapt the curly braces and use url encoding (e.g. spaces become %20). For example:
curl '[Link]
˓→%20Office%20Limited"\}'
Revision Parameters
The Util API provides various utility APIs – e.g. auto-completion APIs used by front-end javascript.
All Util APIs are read-only. The response format is JSON. Javascript calls may want to use the JSONP formatting.
dataset autocomplete
There an autocomplete API for package names which matches on name or title.
This URL:
/api/2/util/dataset/autocomplete?incomplete=a%20novel
Returns:
tag autocomplete
There is also an autocomplete API for tags which looks like this:
This URL:
/api/2/util/tag/autocomplete?incomplete=ru
Returns:
Similarly, there is an autocomplete API for the resource format field which is available at:
/api/2/util/resource/format_autocomplete?incomplete=cs
This returns:
For taking an readable identifier and munging it to ensure it is a valid dataset id. Symbols and whitespeace are
converted into dashes. Example:
/api/util/dataset/munge_name?name=police%20spending%20figures%202009
Returns:
"police-spending-figures-2009"
For taking a title of a package and munging it to a readable and valid dataset id. Symbols and whitespeace are converted
into dashes, with multiple dashes collapsed. Ensures that long titles with a year at the end preserves the year should it
need to be shortened. Example:
/api/util/dataset/munge_title_to_name?title=police:%20spending%20figures%202009
Returns:
"police-spending-figures-2009"
munge tag
For taking a readable word/phrase and munging it to a valid tag (name). Symbols and whitespeace are converted into
dashes. Example:
/api/util/tag/munge?tag=water%20quality
Returns:
"water-quality"
Code Name
200 OK
201 OK and new object created (referred to in the Location header)
301 Moved Permanently
400 Bad Request
403 Not Authorized
404 Not Found
409 Conflict (e.g. name already exists)
500 Service Error
Note: On early CKAN versions, datasets were called “packages” and this name has stuck in some places, specially
internally and on API calls. Package has exactly the same meaning as “dataset”.
To call the CKAN API, post a JSON dictionary in an HTTP POST request to one of CKAN’s API URLs. The
parameters for the API function should be given in the JSON dictionary. CKAN will also return its response in a
JSON dictionary.
One way to post a JSON dictionary to a URL is using the command-line client Curl. For example, to get a list
of the names of all the datasets in the data-explorer group on [Link], install curl and then call the
group_list API function by running this command in a terminal:
curl [Link]
Note: If there are major formatting problems with a request to the API, CKAN may still return an HTTP response
with a 409, 400 or 500 status code (in increasing order of severity). In future CKAN versions we intend to remove
these responses, and instead send a 200 OK response and use the "success" and "error" items.
2. "result": the returned result from the function you called. The type and value of the result depend on which
function you called. In the case of the group_list function it’s a list of strings, the names of all the datasets
that belong to the group.
If there was an error responding to your request, the dictionary will contain an "error" key with details of the
error instead of the "result" key. A response dictionary containing an error will look like this:
{
"help": "Creates a package",
"success": false,
"error": {
"message": "Access denied",
"__type": "Authorization Error"
}
}
You can add datasets using CKAN’s web interface, but when importing many datasets it’s usually more efficient to
automate the process in some way. In this example, we’ll show you how to use the CKAN API to write a Python script
to import datasets into CKAN.
Todo: Make this script more interesting (eg. read data from a CSV file), and all put the script in a .py file somewhere
with tests and import it here.
#!/usr/bin/env python
import urllib2
import urllib
import json
import pprint
# Put the details of the dataset we're going to create into a dict.
dataset_dict = {
'name': 'my_dataset_name',
'notes': 'A long description of my dataset',
'owner_org': 'org_id_or_name'
}
# Use the json module to dump the dictionary to a string for posting.
data_string = [Link]([Link](dataset_dict))
The CKAN APIs are versioned. If you make a request to an API URL without a version number, CKAN will choose
the latest version of the API:
[Link]
Alternatively, you can specify the desired API version number in the URL that you request:
[Link]
Warning: Starting from CKAN 2.9, API tokens are the preferred way of authenticating API calls. The old legacy
API keys will still work but they will be removed in future versions so it is recommended to switch to use API
tokens. Read below for more details.
Some API functions require authorization. The API uses the same authorization functions and configuration as the
web interface, so if a user is authorized to do something in the web interface they’ll be authorized to do it via the API
as well.
When calling an API function that requires authorization, you must authenticate yourself by providing an authenti-
cation key with your HTTP request. Starting from CKAN 2.9 the recommended mechanism to use are API tokens.
These are encrypted keys that can be generated manually from the UI (User Profile > Manage > API tokens) or via
the api_token_create() function. A user can create as many tokens as needed for different uses, and revoke
one or multiple tokens at any time. In addition, enabling the expire_api_token core plugin allows to define the
expiration timestamp for a token.
Site maintainers can use API Token Settings to configure the token generation.
Legacy API keys (UUIDs that look like ec5c0860-9e48-41f3-8850-4a7128b18df8) are still supported, but its use is
discouraged as they are not as secure as tokens and are limited to one per user. Support for legacy API keys will be
removed in future CKAN versions.
To provide your API token in an HTTP request, include it in either an Authorization or X-CKAN-API-Key
header. (The name of the HTTP header can be configured with the apikey_header_name option in your CKAN
configuration file.)
For example, to ask whether or not you’re currently following the user markw on [Link] using curl, run this
command:
request = [Link]('[Link]
˓→')
request.add_header('Authorization', 'XXX')
response_dict = [Link]([Link](request, '{}').read())
Functions defined in [Link] can also be called with an HTTP GET request. For example, to get the list
of datasets (packages) from [Link], open this URL in your browser:
[Link]
Or, to search for datasets (packages) matching the search query spending, on [Link], open this URL in your
browser:
[Link]
Tip: Browser plugins like JSONView for Firefox or Chrome will format and color CKAN’s JSON response nicely in
your browser.
The search query is given as a URL parameter ?q=spending. Multiple URL parameters can be appended, separated
by & characters, for example to get only the first 10 matching datasets open this URL:
[Link]
When an action requires a list of strings as the value of a parameter, the value can be sent by giving the parameter
multiple times in the URL:
[Link]
To cater for scripts from other sites that wish to access the API, the data can be returned in JSONP format, where the
JSON data is ‘padded’ with a function call. The function is named in the ‘callback’ parameter. For example:
[Link]
You can use the upload parameter of the resource_patch() function to upload a new version of a resource file.
This requires a multipart/form-data request, with curl you can do this using the @[Link]:
˓→resource_patch
Note: If you call one of the action functions listed below and the function raises an exception, the API will return a
JSON dictionary with keys "success": false and an "error" key indicating the exception that was raised.
For example member_list() (which returns a list of the members of a group) raises NotFound if the group
doesn’t exist. If you called it over the API, you’d get back a JSON dict like this:
{
"success": false
"error": {
"__type": "Not Found Error",
"message": "Not found"
},
"help": "...",
}
4.9.1 [Link]
API functions for searching for and getting data from CKAN.
[Link].site_read(context, data_dict=None)
Return True.
Return type bool
[Link].package_list(context, data_dict)
Return a list of the names of the site’s datasets (packages).
Parameters
• limit (int) – if given, the list of datasets will be broken into pages of at most limit
datasets per page and only one page will be returned at a time (optional)
• offset (int) – when limit is given, the offset to start returning packages from
Return type list of strings
[Link].current_package_list_with_resources(context, data_dict)
Return a list of the site’s datasets (packages) and their resources.
The list is sorted most-recently-modified first.
Parameters
• limit (int) – if given, the list of datasets will be broken into pages of at most limit
datasets per page and only one page will be returned at a time (optional)
• offset (int) – when limit is given, the offset to start returning packages from
• page (int) – when limit is given, which page to return, Deprecated: use offset
Return type list of dictionaries
[Link].member_list(context, data_dict=None)
Return the members of a group.
The user must have permission to ‘get’ the group.
Parameters
• id (string) – the id or name of the group
• object_type (string) – restrict the members returned to those of a given type, e.g.
'user' or 'package' (optional, default: None)
• capacity (string) – restrict the members returned to those with a given capacity, e.g.
'member', 'editor', 'admin', 'public', 'private' (optional, default: None)
Return type list of (id, type, capacity) tuples
Raises [Link]: if the group doesn’t exist
[Link].package_collaborator_list(context, data_dict)
Return the list of all collaborators for a given package.
Currently you must be an Admin on the package owner organization to manage collaborators.
Note: This action requires the collaborators feature to be enabled with the
[Link].allow_dataset_collaborators configuration option.
Parameters
• id (string) – the id or name of the package
• capacity (string) – (optional) If provided, only users with this capacity are returned
Returns a list of collaborators, each a dict including the package and user id, the capacity and the
last modified date
Return type list of dictionaries
[Link].package_collaborator_list_for_user(context, data_dict)
Return a list of all package the user is a collaborator in
Note: This action requires the collaborators feature to be enabled with the
[Link].allow_dataset_collaborators configuration option.
Parameters
• id (string) – the id or name of the user
• capacity (string) – (optional) If provided, only packages where the user has this ca-
pacity are returned
Returns a list of packages, each a dict including the package id, the capacity and the last modified
date
Return type list of dictionaries
[Link].group_list(context, data_dict)
Return a list of the names of the site’s groups.
Parameters
• order_by (string) – the field to sort the list by, must be 'name' or 'packages'
(optional, default: 'name') Deprecated use sort.
• sort (string) – sorting of the search results. Optional. Default: “title asc” string of field
name and sort-order. The allowed fields are ‘name’, ‘package_count’ and ‘title’
• limit (int) – the maximum number of groups returned (op-
tional) Default: 1000 when all_fields=false unless set in site’s con-
figuration ckan.group_and_organization_list_max Default:
25 when all_fields=true unless set in site’s configuration ckan.
group_and_organization_list_all_fields_max
• offset (int) – when limit is given, the offset to start returning groups from
• groups (list of strings) – a list of names of the groups to return, if given only
groups whose names are in this list will be returned (optional)
• all_fields (bool) – return group dictionaries instead of just names. Only core fields
are returned - get some more using the include_* options. Returning a list of packages is
too expensive, so the packages property for each group is deprecated, but there is a count of
the packages in the package_count property. (optional, default: False)
• include_dataset_count (bool) – if all_fields, include the full package_count (op-
tional, default: True)
• include_extras (bool) – if all_fields, include the group extra fields (optional, default:
False)
• include_tags (bool) – if all_fields, include the group tags (optional, default: False)
• include_groups (bool) – if all_fields, include the groups the groups are in (optional,
default: False).
• include_users (bool) – if all_fields, include the group users (optional, default:
False).
Return type list of strings
[Link].organization_list(context, data_dict)
Return a list of the names of the site’s organizations.
Parameters
• order_by (string) – the field to sort the list by, must be 'name' or 'packages'
(optional, default: 'name') Deprecated use sort.
• sort (string) – sorting of the search results. Optional. Default: “title asc” string of field
name and sort-order. The allowed fields are ‘name’, ‘package_count’ and ‘title’
• limit (int) – the maximum number of organizations returned (op-
tional) Default: 1000 when all_fields=false unless set in site’s con-
figuration ckan.group_and_organization_list_max Default:
25 when all_fields=true unless set in site’s configuration ckan.
group_and_organization_list_all_fields_max
• offset (int) – when limit is given, the offset to start returning organizations from
• organizations (list of strings) – a list of names of the groups to return, if
given only groups whose names are in this list will be returned (optional)
• all_fields (bool) – return group dictionaries instead of just names. Only core fields
are returned - get some more using the include_* options. Returning a list of packages is
too expensive, so the packages property for each group is deprecated, but there is a count of
the packages in the package_count property. (optional, default: False)
• include_dataset_count (bool) – if all_fields, include the full package_count (op-
tional, default: True)
• include_extras (bool) – if all_fields, include the organization extra fields (optional,
default: False)
• include_tags (bool) – if all_fields, include the organization tags (optional, default:
False)
• include_groups (bool) – if all_fields, include the organizations the organizations are
in (optional, default: False)
• include_users (bool) – if all_fields, include the organization users (optional, default:
False).
Return type list of strings
[Link].group_list_authz(context, data_dict)
Return the list of groups that the user is authorized to edit.
Parameters
• available_only (bool) – remove the existing groups in the package (optional, default:
False)
• am_member (bool) – if True return only the groups the logged-in user is a member of,
otherwise return all groups that the user is authorized to edit (for example, sysadmin users
are authorized to edit all groups) (optional, default: False)
Returns list of dictized groups that the user is authorized to edit
Return type list of dicts
[Link].organization_list_for_user(context, data_dict)
Return the organizations that the user has a given permission for.
Specifically it returns the list of organizations that the currently authorized user has a given permission (for
example: “manage_group”) against.
By default this returns the list of organizations that the currently authorized user is member of, in any capacity.
When a user becomes a member of an organization in CKAN they’re given a “capacity” (sometimes called a
“role”), for example “member”, “editor” or “admin”.
Each of these roles has certain permissions associated with it. For example the admin role has the “admin”
permission (which means they have permission to do anything). The editor role has permissions like “cre-
ate_dataset”, “update_dataset” and “delete_dataset”. The member role has the “read” permission.
This function returns the list of organizations that the authorized user has a given permission for. For example
the list of organizations that the user is an admin of, or the list of organizations that the user can create datasets
in. This takes account of when permissions cascade down an organization hierarchy.
Parameters
• id (string) – the name or id of the user to get the organization list for (optional, defaults
to the currently authorized user (logged in or via API key))
• permission (string) – the permission the user has against the returned organizations,
for example "read" or "create_dataset" (optional, default: "manage_group")
• include_dataset_count (bool) – include the package_count in each org (optional,
default: False)
Returns list of organizations that the user has the given permission for
Return type list of dicts
[Link].license_list(context, data_dict)
Return the list of licenses available for datasets on the site.
Return type list of dictionaries
[Link].tag_list(context, data_dict)
Return a list of the site’s tags.
By default only free tags (tags that don’t belong to a vocabulary) are returned. If the vocabulary_id argu-
ment is given then only tags belonging to that vocabulary will be returned instead.
Parameters
• query (string) – a tag name query to search for, if given only tags whose names contain
this string will be returned (optional)
• vocabulary_id (string) – the id or name of a vocabulary, if give only tags that belong
to this vocabulary will be returned (optional)
• all_fields (bool) – return full tag dictionaries instead of just names (optional, default:
False)
Return type list of dictionaries
[Link].user_list(context, data_dict)
Return a list of the site’s user accounts.
Parameters
• q (string) – filter the users returned to those whose names contain a string (optional)
• email (string) – filter the users returned to those whose email match a string (optional)
(you must be a sysadmin to use this filter)
• order_by (string) – which field to sort the list by (optional, de-
fault: 'display_name'). Users can be sorted by 'id', 'name',
'fullname', 'display_name', 'created', 'about', 'sysadmin' or
'number_created_packages'.
• all_fields (bool) – return full user dictionaries instead of just names. (optional, de-
fault: True)
Return type list of user dictionaries. User properties include: number_created_packages
which excludes datasets which are private or draft state.
[Link].package_relationships_list(context, data_dict)
Return a dataset (package)’s relationships.
Parameters
• id (string) – the id or name of the first package
• id2 (string) – the id or name of the second package
• rel – relationship as string see package_relationship_create() for the relation-
ship types (optional)
Return type list of dictionaries
[Link].package_show(context, data_dict)
Return the metadata of a dataset (package) and its resources.
Parameters
• id (string) – the id or name of the dataset
• use_default_schema (bool) – use default package schema instead of a custom
schema defined with an IDatasetForm plugin (default: False)
• include_tracking (bool) – add tracking information to dataset and resources (de-
fault: False)
Return type dictionary
[Link].resource_show(context, data_dict)
Return the metadata of a resource.
Parameters
• id (string) – the id of the resource
• include_tracking (bool) – add tracking information to dataset and resources (de-
fault: False)
Return type dictionary
[Link].resource_view_show(context, data_dict)
Return the metadata of a resource_view.
Parameters id (string) – the id of the resource_view
Return type dictionary
[Link].resource_view_list(context, data_dict)
Return the list of resource views for a particular resource.
Parameters id (string) – the id of the resource
Return type list of dictionaries.
[Link].group_show(context, data_dict)
Return the details of a group.
Parameters
• id (string) – the id or name of the group
• include_datasets (bool) – include a truncated list of the group’s datasets (optional,
default: False)
• include_dataset_count (bool) – include the full package_count (optional, default:
True)
• include_extras (bool) – include the group’s extra fields (optional, default: True)
• include_users (bool) – include the group’s users (optional, default: True if ckan.
auth.public_user_details is True otherwise False)
• include_groups (bool) – include the group’s sub groups (optional, default: True)
• include_tags (bool) – include the group’s tags (optional, default: True)
• include_followers (bool) – include the group’s number of followers (optional, de-
fault: True)
Return type dictionary
[Link].organization_show(context, data_dict)
Return the details of a organization.
Parameters
• id (string) – the id or name of the organization
• include_datasets (bool) – include a truncated list of the org’s datasets (optional,
default: False)
• include_dataset_count (bool) – include the full package_count (optional, default:
True)
• include_extras (bool) – include the organization’s extra fields (optional, default:
True)
• include_users (bool) – include the organization’s users (optional, default: True if
[Link].public_user_details is True otherwise False)
• include_groups (bool) – include the organization’s sub groups (optional, default:
True)
• include_tags (bool) – include the organization’s tags (optional, default: True)
• include_followers (bool) – include the organization’s number of followers (op-
tional, default: True)
Return type dictionary
[Link].group_package_show(context, data_dict)
Return the datasets (packages) of a group.
Parameters
• id (string) – the id or name of the group
• limit (int) – the maximum number of datasets to return (optional)
Return type list of dictionaries
[Link].tag_show(context, data_dict)
Return the details of a tag and all its datasets.
Parameters
• id (string) – the name or id of the tag
• vocabulary_id (string) – the id or name of the tag vocabulary that the tag is in - if it
is not specified it will assume it is a free tag. (optional)
• include_datasets (bool) – include a list of the tag’s datasets. (Up to a limit of 1000
- for more flexibility, use package_search - see package_search() for an example.)
(optional, default: False)
Returns the details of the tag, including a list of all of the tag’s datasets and their details
Return type dictionary
[Link].user_show(context, data_dict)
Return a user account.
Either the id or the user_obj parameter must be given.
Parameters
• id (string) – the id or name of the user (optional)
• user_obj (user dictionary) – the user dictionary of the user (optional)
• include_datasets (bool) – Include a list of datasets the user has created. If it is the
same user or a sysadmin requesting, it includes datasets that are draft or private. (optional,
default:False, limit:50)
• include_num_followers (bool) – Include the number of followers the user has (op-
tional, default:False)
• include_password_hash (bool) – Include the stored password hash (sysadmin only,
optional, default:False)
• include_plugin_extras (bool) – Include the internal plugin extras object (sysad-
min only, optional, default:False)
Returns the details of the user. Includes email_hash and number_created_packages (which excludes
draft or private datasets unless it is the same user or sysadmin making the request). Excludes
the password (hash) and reset_key. If it is the same user or a sysadmin requesting, the email and
apikey are included.
Return type dictionary
[Link].package_autocomplete(context, data_dict)
Return a list of datasets (packages) that match a string.
Datasets with names or titles that contain the query string will be returned.
Parameters
• q (string) – the string to search for
• limit (int) – the maximum number of resource formats to return (optional, default: 10)
Return type list of dictionaries
[Link].format_autocomplete(context, data_dict)
Return a list of resource formats whose names contain a string.
Parameters
• q (string) – the string to search for
• limit (int) – the maximum number of resource formats to return (optional, default: 5)
Return type list of strings
[Link].user_autocomplete(context, data_dict)
Return a list of user names that contain a string.
Parameters
• q (string) – the string to search for
• limit (int) – the maximum number of user names to return (optional, default: 20)
Return type a list of user dictionaries each with keys 'name', 'fullname', and 'id'
[Link].group_autocomplete(context, data_dict)
Return a list of group names that contain a string.
Parameters
• q (string) – the string to search for
• limit (int) – the maximum number of groups to return (optional, default: 20)
Return type a list of group dictionaries each with keys 'name', 'title', and 'id'
[Link].organization_autocomplete(context, data_dict)
Return a list of organization names that contain a string.
Parameters
• q (string) – the string to search for
• limit (int) – the maximum number of organizations to return (optional, default: 20)
Return type a list of organization dictionaries each with keys 'name', 'title', and 'id'
[Link].package_search(context, data_dict)
Searches for packages satisfying a given search criteria.
This action accepts solr search query parameters (details below), and returns a dictionary of results, including
dictized datasets that match the search criteria, a search count and also facet information.
Solr Parameters:
For more in depth treatment of each paramter, please read the Solr Documentation.
This action accepts a subset of solr’s search query parameters:
Parameters
• q (string) – the solr query. Optional. Default: "*:*"
• fq (string) – any filter queries to apply. Note: +site_id:{ckan_site_id} is
added to this string prior to the query being executed.
• fq_list (list of strings) – additional filter queries to apply.
• sort (string) – sorting of the search results. Optional. Default: 'score desc,
metadata_modified desc'. As per the solr documentation, this is a comma-
separated string of field names and sort-orderings.
• rows (int) – the maximum number of matching rows (datasets) to return. (optional,
default: 10, upper limit: 1000 unless set in site’s configuration [Link].
rows_max)
• start (int) – the offset in the complete result for where the set of returned datasets should
begin.
• facet (string) – whether to enable faceted results. Default: True.
• [Link] (int) – the minimum counts for facet fields should be included in the
results.
• [Link] (int) – the maximum number of values the facet fields return. A negative
value means unlimited. This can be set instance-wide with the [Link] config
option. Default is 50.
• [Link] (list of strings) – the fields to facet upon. Default empty. If empty,
then the returned facet information is empty.
{'count': 2,
'results': [ { <snip> }, { <snip> }],
'search_facets': {u'tags': {'items': [{'count': 1,
'display_name': u'tolstoy',
'name': u'tolstoy'},
{'count': 2,
'display_name': u'russian',
'name': u'russian'}
]
}
}
}
Limitations:
The full solr query language is not exposed, including.
fl The parameter that controls which fields are returned in the solr query. fl can be None or a list of result fields,
such as [‘id’, ‘extras_custom_field’]. if fl = None, datasets are returned as a list of full dictionary.
[Link].resource_search(context, data_dict)
Searches for resources satisfying a given search criteria.
It returns a dictionary with 2 fields: count and results. The count field contains the total number of
Resources found without the limit or query parameters having an effect. The results field is a list of dictized
Resource objects.
The ‘query’ parameter is a required field. It is a string of the form {field}:{term} or a list of strings, each
of the same form. Within each string, {field} is a field or extra field on the Resource domain object.
If {field} is "hash", then an attempt is made to match the {term} as a prefix of the [Link] field.
If {field} is an extra field, then an attempt is made to match against the extra fields stored against the
Resource.
Note: The search is limited to search against extra fields declared in the config setting ckan.
extra_resource_fields.
Note: Due to a Resource’s extra fields being stored as a json blob, the match is made against the json string
representation. As such, false positives may occur:
If the search criteria is:
query = "field1:term1"
will match the search criteria! This is a known short-coming of this approach.
All matches are made ignoring case; and apart from the "hash" field, a term matches if it is a substring of the
field’s value.
Finally, when specifying more than one search criteria, the criteria are AND-ed together.
The order parameter is used to control the ordering of the results. Currently only ordering one field is available,
and in ascending order only.
The fields parameter is deprecated as it is not compatible with calling this action with a GET request to the
action API.
The context may contain a flag, search_query, which if True will make this action behave as if being used by
the internal search api. ie - the results will not be dictized, and SearchErrors are thrown for bad search queries
(rather than ValidationErrors).
Parameters
• query (string or list of strings of the form {field}:{term1}) – The search criteria.
See above for description.
• fields (dict of fields to search terms.) – Deprecated
• order_by (string) – A field on the Resource model that orders the results.
• offset (int) – Apply an offset to the query.
• limit (int) – Apply a limit to the query.
Returns A dictionary with a count field, and a results field.
Return type dict
[Link].tag_search(context, data_dict)
Return a list of tags whose names contain a given string.
By default only free tags (tags that don’t belong to any vocabulary) are searched. If the vocabulary_id
argument is given then only tags belonging to that vocabulary will be searched instead.
Parameters
• query (string or list of strings) – the string(s) to search for
• vocabulary_id (string) – the id or name of the tag vocabulary to search in (optional)
• fields (dictionary) – deprecated
• limit (int) – the maximum number of tags to return
• offset (int) – when limit is given, the offset to start returning tags from
Returns
A dictionary with the following keys:
'count' The number of tags in the result.
'results' The list of tags whose names contain the given string, a list of dictionaries.
Return type dictionary
[Link].tag_autocomplete(context, data_dict)
Return a list of tag names that contain a given string.
By default only free tags (tags that don’t belong to any vocabulary) are searched. If the vocabulary_id
argument is given then only tags belonging to that vocabulary will be searched instead.
Parameters
• query (string) – the string to search for
• vocabulary_id (string) – the id or name of the tag vocabulary to search in (optional)
• fields (dictionary) – deprecated
• limit (int) – the maximum number of tags to return
• offset (int) – when limit is given, the offset to start returning tags from
Return type list of strings
[Link].task_status_show(context, data_dict)
Return a task status.
Either the id parameter or the entity_id, task_type and key parameters must be given.
Parameters
• id (string) – the id of the task status (optional)
• entity_id (string) – the entity_id of the task status (optional)
• task_type (string) – the task_type of the task status (optional)
• key (string) – the key of the task status (optional)
Return type dictionary
[Link].term_translation_show(context, data_dict)
Return the translations for the given term(s) and language(s).
Parameters
• terms (list of strings) – the terms to search for translations of, e.g. 'Russian',
'romantic novel'
• lang_codes (list of language code strings) – the language codes of the
languages to search for translations into, e.g. 'en', 'de' (optional, default is to search for
translations into any language)
Return type a list of term translation dictionaries each with keys 'term' (the term searched for,
in the source language), 'term_translation' (the translation of the term into the target
language) and 'lang_code' (the language code of the target language)
[Link].get_site_user(context, data_dict)
Return the ckan site user
Parameters defer_commit (bool) – by default (or if set to false) get_site_user will commit
and clean up the current transaction. If set to true, caller is responsible for commiting transac-
tion after get_site_user is called. Leaving open connections can cause cli commands to hang!
(optional, default: False)
[Link].status_show(context, data_dict)
Return a dictionary with information about the site’s configuration.
Return type dictionary
[Link].vocabulary_list(context, data_dict)
Return a list of all the site’s tag vocabularies.
Return type list of dictionaries
[Link].vocabulary_show(context, data_dict)
Return a single tag vocabulary.
Parameters id (string) – the id or name of the vocabulary
Returns the vocabulary.
Return type dictionary
[Link].user_activity_list(context, data_dict)
Return a user’s public activity stream.
You must be authorized to view the user’s profile.
Parameters
• id (string) – the id or name of the user
• offset (int) – where to start getting activity items from (optional, default: 0)
• limit (int) – the maximum number of activities to return (optional, default: 31 unless
set in site’s configuration ckan.activity_list_limit, upper limit: 100 unless set
in site’s configuration ckan.activity_list_limit_max)
Return type list of dictionaries
[Link].package_activity_list(context, data_dict)
Return a package’s activity stream (not including detail)
You must be authorized to view the package.
Parameters
• id (string) – the id or name of the package
• offset (int) – where to start getting activity items from (optional, default: 0)
• limit (int) – the maximum number of activities to return (optional, default: 31 unless
set in site’s configuration ckan.activity_list_limit, upper limit: 100 unless set
in site’s configuration ckan.activity_list_limit_max)
• include_hidden_activity (bool) – whether to include ‘hidden’ activity, which
is not shown in the Activity Stream page. Hidden activity includes activity done
by the site_user, such as harvests, which are not shown in the activity stream be-
cause they can be too numerous, or activity by other users specified in config option
ckan.hide_activity_from_users. NB Only sysadmins may set include_hidden_activity to
true. (default: false)
Return type list of dictionaries
[Link].group_activity_list(context, data_dict)
Return a group’s activity stream.
You must be authorized to view the group.
Parameters
• id (string) – the id or name of the group
• offset (int) – where to start getting activity items from (optional, default: 0)
• limit (int) – the maximum number of activities to return (optional, default: 31 unless
set in site’s configuration ckan.activity_list_limit, upper limit: 100 unless set
in site’s configuration ckan.activity_list_limit_max)
• include_hidden_activity (bool) – whether to include ‘hidden’ activity, which
is not shown in the Activity Stream page. Hidden activity includes activity done
by the site_user, such as harvests, which are not shown in the activity stream be-
cause they can be too numerous, or activity by other users specified in config option
ckan.hide_activity_from_users. NB Only sysadmins may set include_hidden_activity to
true. (default: false)
Return type list of dictionaries
[Link].organization_activity_list(context, data_dict)
Return a organization’s activity stream.
Parameters
• id (string) – the id or name of the organization
• offset (int) – where to start getting activity items from (optional, default: 0)
• limit (int) – the maximum number of activities to return (optional, default: 31 unless
set in site’s configuration ckan.activity_list_limit, upper limit: 100 unless set
in site’s configuration ckan.activity_list_limit_max)
• include_hidden_activity (bool) – whether to include ‘hidden’ activity, which
is not shown in the Activity Stream page. Hidden activity includes activity done
by the site_user, such as harvests, which are not shown in the activity stream be-
cause they can be too numerous, or activity by other users specified in config option
ckan.hide_activity_from_users. NB Only sysadmins may set include_hidden_activity to
true. (default: false)
Return type list of dictionaries
[Link].recently_changed_packages_activity_list(context,
data_dict)
Return the activity stream of all recently added or changed packages.
Parameters
• offset (int) – where to start getting activity items from (optional, default: 0)
• limit (int) – the maximum number of activities to return (optional, default: 31 unless
set in site’s configuration ckan.activity_list_limit, upper limit: 100 unless set
in site’s configuration ckan.activity_list_limit_max)
Return type list of dictionaries
[Link].user_follower_count(context, data_dict)
Return the number of followers of a user.
Parameters id (string) – the id or name of the user
Return type int
[Link].dataset_follower_count(context, data_dict)
Return the number of followers of a dataset.
Parameters id (string) – the id or name of the dataset
Return type int
[Link].group_follower_count(context, data_dict)
Return the number of followers of a group.
Parameters id (string) – the id or name of the group
Return type int
[Link].organization_follower_count(context, data_dict)
Return the number of followers of an organization.
Parameters id (string) – the id or name of the organization
Return type int
[Link].user_follower_list(context, data_dict)
Return the list of users that are following the given user.
Parameters id (string) – the id or name of the user
Return type list of dictionaries
[Link].dataset_follower_list(context, data_dict)
Return the list of users that are following the given dataset.
Parameters id (string) – the id or name of the dataset
Return type list of dictionaries
[Link].group_follower_list(context, data_dict)
Return the list of users that are following the given group.
Parameters id (string) – the id or name of the group
Return type list of dictionaries
[Link].organization_follower_list(context, data_dict)
Return the list of users that are following the given organization.
Parameters id (string) – the id or name of the organization
Return type list of dictionaries
[Link].am_following_user(context, data_dict)
Return True if you’re following the given user, False if not.
Parameters id (string) – the id or name of the user
[Link].activity_data_show(context, data_dict)
Show the data from an item of ‘activity’ (part of the activity stream).
For example for a package update this returns just the dataset dict but none of the activity stream info of who
and when the version was created.
Parameters
• id (string) – the id of the activity
• object_type (string) – ‘package’, ‘user’, ‘group’ or ‘organization’
Return type dictionary
[Link].activity_diff(context, data_dict)
Returns a diff of the activity, compared to the previous version of the object
Parameters
• id (string) – the id of the activity
• object_type (string) – ‘package’, ‘user’, ‘group’ or ‘organization’
• diff_type (string) – ‘unified’, ‘context’, ‘html’
[Link].member_roles_list(context, data_dict)
Return the possible roles for members of groups and organizations.
Parameters group_type (string) – the group type, either "group" or "organization"
(optional, default "organization")
Returns a list of dictionaries each with two keys: "text" (the display name of the role, e.g.
"Admin") and "value" (the internal name of the role, e.g. "admin")
Return type list of dictionaries
[Link].help_show(context, data_dict)
Return the help string for a particular API action.
Parameters name (string) – Action function name (eg user_create, package_search)
Returns The help string for the action function, or None if the function does not have a docstring.
Return type string
Raises [Link]: if the action function doesn’t exist
[Link].config_option_show(context, data_dict)
Show the current value of a particular configuration option.
Only returns runtime-editable config options (the ones returned by config_option_list()), which can
be updated with the config_option_update() action.
Parameters key (string) – The configuration option key
Returns The value of the config option from either the system_info table or ini file.
Return type string
Raises [Link]: if config option is not in the schema (whitelisted as
editable).
[Link].config_option_list(context, data_dict)
Return a list of runtime-editable config options keys that can be updated with
config_option_update().
[Link].job_list(context, data_dict)
List enqueued background jobs.
Parameters queues (list) – Queues to list jobs from. If not given then the jobs from all queues
are listed.
Returns The currently enqueued background jobs.
Return type list
New in version 2.7.
[Link].job_show(context, data_dict)
Show details for a background job.
Parameters id (string) – The ID of the background job.
Returns Details about the background job.
Return type dict
New in version 2.7.
[Link].api_token_list(context, data_dict)
Return list of all available API Tokens for current user.
Returns collection of all API Tokens
Return type list
New in version 2.9.
4.9.2 [Link]
[Link].package_collaborator_create(context, data_dict)
Make a user a collaborator in a dataset.
If the user is already a collaborator in the dataset then their capacity will be updated.
Currently you must be an Admin on the dataset owner organization to manage collaborators.
Note: This action requires the collaborators feature to be enabled with the
[Link].allow_dataset_collaborators configuration option.
Parameters
• id (string) – the id or name of the dataset
• user_id (string) – the id or name of the user to add or edit
• capacity (string) – the capacity or role of the membership. Must be one of “editor”
or “member”. Additionally if [Link].allow_admin_collaborators is set to True, “admin”
is also allowed.
Returns the newly created (or updated) collaborator
Return type dictionary
[Link].group_create(context, data_dict)
Create a new group.
You must be authorized to create groups.
Plugins may change the parameters of this function depending on the value of the type parameter, see the
IGroupForm plugin interface.
Parameters
• name (string) – the name of the group, a string between 2 and 100 characters long,
containing only lowercase alphanumeric characters, - and _
• id (string) – the id of the group (optional)
• title (string) – the title of the group (optional)
• description (string) – the description of the group (optional)
• image_url (string) – the URL to an image to be displayed on the group’s page (op-
tional)
• type (string) – the type of the group (optional, default: 'group'), IGroupForm
plugins associate themselves with different group types and provide custom group handling
behaviour for these types Cannot be ‘organization’
• state (string) – the current state of the group, e.g. 'active' or 'deleted',
only active groups show up in search results and other lists of groups, this parameter will
be ignored if you are not authorized to change the state of the group (optional, default:
'active')
• approval_status (string) – (optional)
• extras (list of dataset extra dictionaries) – the group’s extras (op-
tional), extras are arbitrary (key: value) metadata items that can be added to groups, each
extra dictionary should have keys 'key' (a string), 'value' (a string), and optionally
'deleted'
• packages (list of dictionaries) – the datasets (packages) that belong to the
group, a list of dictionaries each with keys 'name' (string, the id or name of the dataset)
and optionally 'title' (string, the title of the dataset)
• groups (list of dictionaries) – the groups that belong to the group, a list of
dictionaries each with key 'name' (string, the id or name of the group) and optionally
'capacity' (string, the capacity in which the group is a member of the group)
• users (list of dictionaries) – the users that belong to the group, a list of
dictionaries each with key 'name' (string, the id or name of the user) and optionally
'capacity' (string, the capacity in which the user is a member of the group)
Returns the newly created group (unless ‘return_id_only’ is set to True in the context, in which case
just the group id will be returned)
Return type dictionary
[Link].organization_create(context, data_dict)
Create a new organization.
You must be authorized to create organizations.
Plugins may change the parameters of this function depending on the value of the type parameter, see the
IGroupForm plugin interface.
Parameters
• name (string) – the name of the organization, a string between 2 and 100 characters
long, containing only lowercase alphanumeric characters, - and _
• id (string) – the id of the organization (optional)
• title (string) – the title of the organization (optional)
• description (string) – the description of the organization (optional)
• image_url (string) – the URL to an image to be displayed on the organization’s page
(optional)
• state (string) – the current state of the organization, e.g. 'active' or 'deleted',
only active organizations show up in search results and other lists of organizations, this
parameter will be ignored if you are not authorized to change the state of the organization
(optional, default: 'active')
• approval_status (string) – (optional)
• extras (list of dataset extra dictionaries) – the organization’s extras
(optional), extras are arbitrary (key: value) metadata items that can be added to organi-
zations, each extra dictionary should have keys 'key' (a string), 'value' (a string), and
optionally 'deleted'
• packages (list of dictionaries) – the datasets (packages) that belong to the
organization, a list of dictionaries each with keys 'name' (string, the id or name of the
dataset) and optionally 'title' (string, the title of the dataset)
• users (list of dictionaries) – the users that belong to the organization, a list
of dictionaries each with key 'name' (string, the id or name of the user) and optionally
'capacity' (string, the capacity in which the user is a member of the organization)
Returns the newly created organization (unless ‘return_id_only’ is set to True in the context, in
which case just the organization id will be returned)
Return type dictionary
[Link].rating_create(context, data_dict)
Rate a dataset (package).
You must provide your API key in the Authorization header.
Parameters
• package (string) – the name or id of the dataset to rate
• rating (int) – the rating to give to the dataset, an integer between 1 and 5
Returns a dictionary with two keys: 'rating average' (the average rating of the dataset you
rated) and 'rating count' (the number of times the dataset has been rated)
Return type dictionary
[Link].user_create(context, data_dict)
Create a new user.
You must be authorized to create users.
Parameters
• name (string) – the name of the new user, a string between 2 and 100 characters in
length, containing only lowercase alphanumeric characters, - and _
• email (string) – the email address for the new user
• password (string) – the password of the new user, a string of at least 4 characters
• id (string) – the id of the new user (optional)
• fullname (string) – the full name of the new user (optional)
• about (string) – a description of the new user (optional)
• image_url (string) – the URL to an image to be displayed on the group’s page (op-
tional)
• plugin_extras (dict) – private extra user data belonging to plugins. Only sysadmin
users may set this value. It should be a dict that can be dumped into JSON, and plugins
should namespace their extras with the plugin name to avoid collisions with other plugins,
eg:
{
"name": "test_user",
"email": "test@[Link]",
"plugin_extras": {
"my_plugin": {
"private_extra": 1
},
"another_plugin": {
"another_extra": True
}
}
}
• role (string) – role of the user in the group. One of member, editor, or admin
Returns the newly created user
Return type dictionary
[Link].vocabulary_create(context, data_dict)
Create a new tag vocabulary.
You must be a sysadmin to create vocabularies.
Parameters
• name (string) – the name of the new vocabulary, e.g. 'Genre'
• tags (list of tag dictionaries) – the new tags to add to the new vocabulary,
for the format of tag dictionaries see tag_create()
Returns the newly-created vocabulary
Return type dictionary
[Link].activity_create(context, activity_dict, **kw)
Create a new activity stream activity.
You must be a sysadmin to create new activities.
Parameters
• user_id (string) – the name or id of the user who carried out the activity, e.g.
'seanh'
• object_id – the name or id of the object of the activity, e.g. 'my_dataset'
• activity_type (string) – the type of the activity, this must be an activity type that
CKAN knows how to render, e.g. 'new package', 'changed user', 'deleted
group' etc.
• data (dictionary) – any additional data about the activity
Returns the newly created activity
Return type dictionary
[Link].tag_create(context, data_dict)
Create a new vocabulary tag.
You must be a sysadmin to create vocabulary tags.
You can only use this function to create tags that belong to a vocabulary, not to create free tags. (To create a new
free tag simply add the tag to a package, e.g. using the package_update() function.)
Parameters
• name (string) – the name for the new tag, a string between 2 and 100 characters long
containing only alphanumeric characters and -, _ and ., e.g. 'Jazz'
• vocabulary_id (string) – the id of the vocabulary that the new tag should be added
to, e.g. the id of vocabulary 'Genre'
Returns the newly-created tag
Return type dictionary
[Link].follow_user(context, data_dict)
Start following another user.
You must provide your API key in the Authorization header.
Parameters
• user (string) – name or id of the user who owns new API Token
• name (string) – distinctive name for API Token
Returns Returns a dict with the key “token” containing the encoded token value. Extensions can
privide additional fields via add_extra method of IApiToken
Return type dictionary
4.9.3 [Link]
Note: Update methods may delete parameters not explicitly provided in the data_dict. If you want to edit only
a specific attribute use resource_patch instead.
Note: Update methods may delete parameters not explicitly provided in the data_dict. If you want to edit only
a specific attribute use package_patch instead.
match__name="xyz"
match__notes="old notes"
update__notes="new notes"
• Replace all fields at dataset level only, keep resources (note: dataset id and type fields can’t be deleted)
match={"id": "1234abc-1420-cbad-1922"}
filter=["+resources", "-*"]
update={"name": "fresh-start", "title": "Fresh Start"}
match={"id": "abc0123-1420-cbad-1922"}
update__resources__extend=[{"name": "new resource", "url": "[Link]
˓→"}]
match={"name": "my-data"}
update__resources__0={"name": "new name, first resource"}
match={"name": "their-data"}
update__resources__19cfad={"description": "right one for sure"}
match={"id": "34a12bc-1420-cbad-1922"}
filter=["+resources__1492a__id", "-resources__1492a__*"]
update__resources__1492a={"name": "edits here", "url": "[Link]
Returns a dict containing ‘package’:the updated dataset with fields filtered by include parameter
Return type dictionary
[Link].package_resource_reorder(context, data_dict)
Reorder resources against datasets. If only partial resource ids are supplied then these are assumed to be first
and the other resources will stay in their original order
Parameters
• id (string) – the id or name of the package to update
• order (list) – a list of resource ids in the order needed
[Link].package_relationship_update(context, data_dict)
Update a relationship between two datasets (packages).
The subject, object and type parameters are required to identify the relationship. Only the comment can be
updated.
You must be authorized to edit both the subject and the object datasets.
Parameters
• subject (string) – the name or id of the dataset that is the subject of the relationship
• object (string) – the name or id of the dataset that is the object of the relationship
Note: Update methods may delete parameters not explicitly provided in the data_dict. If you want to edit only
a specific attribute use group_patch instead.
Plugins may change the parameters of this function depending on the value of the group’s type attribute, see
the IGroupForm plugin interface.
For further parameters see group_create().
Parameters id (string) – the name or id of the group to update
Returns the updated group
Return type dictionary
[Link].organization_update(context, data_dict)
Update a organization.
You must be authorized to edit the organization.
Note: Update methods may delete parameters not explicitly provided in the data_dict. If you want to edit only
a specific attribute use organization_patch instead.
Note: Update methods may delete parameters not explicitly provided in the data_dict. If you want to edit only
a specific attribute use user_patch instead.
[Link].term_translation_update_many(context, data_dict)
Create or update many term translations at once.
Parameters data (list of dictionaries) – the term translation dictionaries to create or
update, for the format of term translation dictionaries see term_translation_update()
Returns a dictionary with key 'success' whose value is a string stating how many term transla-
tions were updated
Return type string
[Link].vocabulary_update(context, data_dict)
Update a tag vocabulary.
You must be a sysadmin to update vocabularies.
For further parameters see vocabulary_create().
Parameters id (string) – the id of the vocabulary to update
Returns the updated vocabulary
Return type dictionary
[Link].dashboard_mark_activities_old(context, data_dict)
Mark all the authorized user’s new dashboard activities as old.
This will reset dashboard_new_activities_count() to 0.
[Link].send_email_notifications(context, data_dict)
Send any pending activity stream notification emails to users.
You must provide a sysadmin’s API key in the Authorization header of the request, or call this action from the
command-line via a paster post . . . command.
[Link].package_owner_org_update(context, data_dict)
Update the owning organization of a dataset
Parameters
• id (string) – the name or id of the dataset to update
• organization_id (string) – the name or id of the owning organization
[Link].bulk_update_private(context, data_dict)
Make a list of datasets private
Parameters
• datasets (list of strings) – list of ids of the datasets to update
• org_id (int) – id of the owning organization
[Link].bulk_update_public(context, data_dict)
Make a list of datasets public
Parameters
• datasets (list of strings) – list of ids of the datasets to update
• org_id (int) – id of the owning organization
[Link].bulk_update_delete(context, data_dict)
Make a list of datasets deleted
Parameters
• datasets (list of strings) – list of ids of the datasets to update
get_action('config_option_update)({}, {
'ckan.site_title': 'My Open Data site',
'ckan.homepage_layout': 2,
})
Note: You can see all available runtime-editable configuration options calling the config_option_list()
action
Note: Extensions can modify which configuration options are runtime-editable. For details, check Making
configuration options runtime-editable.
Warning: You should only add config options that you are comfortable they can be edited during runtime,
such as ones you’ve added in your own extension, or have reviewed the use of in core CKAN.
4.9.4 [Link]
New in version 2.3. API functions for partial updates of existing data in CKAN
[Link].package_patch(context, data_dict)
Patch a dataset (package).
Parameters id (string) – the id or name of the dataset
The difference between the update and patch methods is that the patch will perform an update of the provided
parameters, while leaving all other parameters unchanged, whereas the update methods deletes all parameters
not explicitly provided in the data_dict.
You are able to partially update and/or create resources with package_patch. If you are updating existing re-
sources be sure to provide the resource id. Existing resources excluded from the package_patch data_dict will
be removed. Resources in the package data_dict without an id will be treated as new resources and will be
added. New resources added with the patch method do not create the default views.
You must be authorized to edit the dataset and the groups that it belongs to.
[Link].resource_patch(context, data_dict)
Patch a resource
Parameters id (string) – the id of the resource
The difference between the update and patch methods is that the patch will perform an update of the provided
parameters, while leaving all other parameters unchanged, whereas the update methods deletes all parameters
not explicitly provided in the data_dict
[Link].group_patch(context, data_dict)
Patch a group
Parameters id (string) – the id or name of the group
The difference between the update and patch methods is that the patch will perform an update of the provided
parameters, while leaving all other parameters unchanged, whereas the update methods deletes all parameters
not explicitly provided in the data_dict
[Link].organization_patch(context, data_dict)
Patch an organization
Parameters id (string) – the id or name of the organization
The difference between the update and patch methods is that the patch will perform an update of the provided
parameters, while leaving all other parameters unchanged, whereas the update methods deletes all parameters
not explicitly provided in the data_dict
4.9.5 [Link]
Purging a database completely removes the dataset from the CKAN database, whereas deleting a dataset simply
marks the dataset as deleted (it will no longer show up in the front-end, but is still in the db).
[Link].organization_delete(context, data_dict)
Delete an organization.
You must be authorized to delete the organization and no datasets should belong to the organization unless
‘[Link].create_unowned_dataset=True’
Parameters id (string) – the name or id of the organization
[Link].group_purge(context, data_dict)
Purge a group.
Purging a group completely removes the group from the CKAN database, whereas deleting a group simply
marks the group as deleted (it will no longer show up in the frontend, but is still in the db).
Datasets in the organization will remain, just not in the purged group.
You must be authorized to purge the group.
Parameters id (string) – the name or id of the group to be purged
[Link].organization_purge(context, data_dict)
Purge an organization.
Purging an organization completely removes the organization from the CKAN database, whereas deleting an
organization simply marks the organization as deleted (it will no longer show up in the frontend, but is still in
the db).
Datasets owned by the organization will remain, just not in an organization any more.
You must be authorized to purge the organization.
Parameters id (string) – the name or id of the organization to be purged
[Link].task_status_delete(context, data_dict)
Delete a task status.
You must be a sysadmin to delete task statuses.
Parameters id (string) – the id of the task status to delete
[Link].vocabulary_delete(context, data_dict)
Delete a tag vocabulary.
You must be a sysadmin to delete vocabularies.
Parameters id (string) – the id of the vocabulary
[Link].tag_delete(context, data_dict)
Delete a tag.
You must be a sysadmin to delete tags.
Parameters
• id (string) – the id or name of the tag
• vocabulary_id (string) – the id or name of the vocabulary that the tag belongs to
(optional, default: None)
[Link].unfollow_user(context, data_dict)
Stop following a user.
Parameters id (string) – the id or name of the user to stop following
[Link].unfollow_dataset(context, data_dict)
Stop following a dataset.
Parameters id (string) – the id or name of the dataset to stop following
[Link].group_member_delete(context, data_dict=None)
Remove a user from a group.
You must be authorized to edit the group.
Parameters
• id (string) – the id or name of the group
• username (string) – name or id of the user to be removed
[Link].organization_member_delete(context, data_dict=None)
Remove a user from an organization.
You must be authorized to edit the organization.
Parameters
• id (string) – the id or name of the organization
• username (string) – name or id of the user to be removed
[Link].unfollow_group(context, data_dict)
Stop following a group.
Parameters id (string) – the id or name of the group to stop following
[Link].job_clear(context, data_dict)
Clear background job queues.
Does not affect jobs that are already being processed.
Parameters queues (list) – The queues to clear. If not given then ALL queues are cleared.
Returns The cleared queues.
Return type list
New in version 2.7.
[Link].job_cancel(context, data_dict)
Cancel a queued background job.
Removes the job from the queue and deletes it.
Parameters id (string) – The ID of the background job.
New in version 2.7.
[Link].api_token_revoke(context, data_dict)
Delete API Token.
Parameters
• token (string) – Token to remove(required if jti not specified).
• jti (string) – Id of the token to remove(overrides token if specified).
New in version 3.0.