get Package

get Package

activity Module

libckan.logic.action.get.activity.activity_detail_list(client=<libckan.model.client.Client object>, id='')

Return an activity’s list of activity detail items.

Parameters:
  • client (libckan.model.client.Client) – the CKAN Client. Default: an instance of libckan.model.client.Client
  • id (string) – the id of the activity
Return type:

list of dictionaries.

Returns:

the dictionary returned by the CKAN API, with the keys “help”,”result”, and “success”. “results” is a list of packages (dict).

Returns:

dict

Raises: libckan.model.exceptions.CKANError:
An error occurred accessing CKAN API
libckan.logic.action.get.activity.dashboard_activity_list(client=<libckan.model.client.Client object>, offset='', limit='')

Return the authorized user’s dashboard activity stream.

Unlike the activity dictionaries returned by other *_activity_list actions, these activity dictionaries have an extra boolean value with key is_new that tells you whether the activity happened since the user last viewed her dashboard ('is_new': True) or not ('is_new': False).

The user’s own activities are always marked 'is_new': False.

Parameters:
  • client (libckan.model.client.Client) – the CKAN Client. Default: an instance of libckan.model.client.Client
  • offset (int) – where to start getting activity items from (optional, default: 0)
  • limit – the maximum number of activities to return (optional, default: 31, the default value is configurable via the ckan.activity_list_limit setting)
Return type:

list of activity dictionaries

Returns:

the dictionary returned by the CKAN API, with the keys “help”,”result”, and “success”. “results” is a list of packages (dict).

Returns:

dict

Raises: libckan.model.exceptions.CKANError:
An error occurred accessing CKAN API
libckan.logic.action.get.activity.dashboard_activity_list_html(client=<libckan.model.client.Client object>, offset='', limit='')

Return the authorized user’s dashboard activity stream as HTML.

The activity stream is rendered as a snippet of HTML meant to be included in an HTML page, i.e. it doesn’t have any HTML header or footer.

Parameters:
  • client (libckan.model.client.Client) – the CKAN Client. Default: an instance of libckan.model.client.Client
  • offset (int) – where to start getting activity items from (optional, default: 0)
  • limit (int) – the maximum number of activities to return (optional, default: 31, the default value is configurable via the ckan.activity_list_limit setting)
Return type:

string

Returns:

the dictionary returned by the CKAN API, with the keys “help”,”result”, and “success”. “results” is a list of packages (dict).

Returns:

dict

Raises: libckan.model.exceptions.CKANError:
An error occurred accessing CKAN API
libckan.logic.action.get.activity.dashboard_new_activities_count(client=<libckan.model.client.Client object>)

Return the number of new activities in the user’s dashboard.

Return the number of new activities in the authorized user’s dashboard activity stream.

Activities from the user herself are not counted by this function even though they appear in the dashboard (users don’t want to be notified about things they did themselves).

Return type:int
Parameters:client (libckan.model.client.Client) – the CKAN Client. Default: an instance of libckan.model.client.Client
Returns:the dictionary returned by the CKAN API, with the keys “help”,”result”, and “success”. “results” is a list of packages (dict).
Returns:dict
Raises: libckan.model.exceptions.CKANError:
An error occurred accessing CKAN API
libckan.logic.action.get.activity.group_activity_list(client=<libckan.model.client.Client object>, id='', offset='', limit='')

Return a group’s activity stream.

You must be authorized to view the group.

Parameters:
  • client (libckan.model.client.Client) – the CKAN Client. Default: an instance of libckan.model.client.Client
  • 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, the default value is configurable via the ckan.activity_list_limit setting)
Return type:

list of dictionaries

Returns:

the dictionary returned by the CKAN API, with the keys “help”,”result”, and “success”. “results” is a list of packages (dict).

Returns:

dict

Raises: libckan.model.exceptions.CKANError:
An error occurred accessing CKAN API
libckan.logic.action.get.activity.group_activity_list_html(client=<libckan.model.client.Client object>, id='', offset='', limit='')

Return a group’s activity stream as HTML.

The activity stream is rendered as a snippet of HTML meant to be included in an HTML page, i.e. it doesn’t have any HTML header or footer.

Parameters:
  • client (libckan.model.client.Client) – the CKAN Client. Default: an instance of libckan.model.client.Client
  • 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, the default value is configurable via the ckan.activity_list_limit setting)
Return type:

string

Returns:

the dictionary returned by the CKAN API, with the keys “help”,”result”, and “success”. “results” is a list of packages (dict).

Returns:

dict

Raises: libckan.model.exceptions.CKANError:
An error occurred accessing CKAN API
libckan.logic.action.get.activity.organization_activity_list(client=<libckan.model.client.Client object>, id='')

Return a organization’s activity stream.

Parameters:
  • client (libckan.model.client.Client) – the CKAN Client. Default: an instance of libckan.model.client.Client
  • id (string) – the id or name of the organization
Return type:

list of dictionaries

Returns:

the dictionary returned by the CKAN API, with the keys “help”,”result”, and “success”. “results” is a list of packages (dict).

Returns:

dict

Raises: libckan.model.exceptions.CKANError:
An error occurred accessing CKAN API
libckan.logic.action.get.activity.organization_activity_list_html(client=<libckan.model.client.Client object>, id='')

Return a organization’s activity stream as HTML.

The activity stream is rendered as a snippet of HTML meant to be included in an HTML page, i.e. it doesn’t have any HTML header or footer.

Parameters:
  • client (libckan.model.client.Client) – the CKAN Client. Default: an instance of libckan.model.client.Client
  • id (string) – the id or name of the organization
Return type:

string

Returns:

the dictionary returned by the CKAN API, with the keys “help”,”result”, and “success”. “results” is a list of packages (dict).

Returns:

dict

Raises: libckan.model.exceptions.CKANError:
An error occurred accessing CKAN API
libckan.logic.action.get.activity.package_activity_list(client=<libckan.model.client.Client object>, id='', offset='', limit='')

Return a package’s activity stream.

You must be authorized to view the package.

Parameters:
  • client (libckan.model.client.Client) – the CKAN Client. Default: an instance of libckan.model.client.Client
  • 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, the default value is configurable via the ckan.activity_list_limit setting)
Return type:

list of dictionaries

Returns:

the dictionary returned by the CKAN API, with the keys “help”,”result”, and “success”. “results” is a list of packages (dict).

Returns:

dict

Raises: libckan.model.exceptions.CKANError:
An error occurred accessing CKAN API
libckan.logic.action.get.activity.package_activity_list_html(client=<libckan.model.client.Client object>, id='', offset='', limit='')

Return a package’s activity stream as HTML.

The activity stream is rendered as a snippet of HTML meant to be included in an HTML page, i.e. it doesn’t have any HTML header or footer.

Parameters:
  • client (libckan.model.client.Client) – the CKAN Client. Default: an instance of libckan.model.client.Client
  • 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, the default value is configurable via the ckan.activity_list_limit setting)
Return type:

string

Returns:

the dictionary returned by the CKAN API, with the keys “help”,”result”, and “success”. “results” is a list of packages (dict).

Returns:

dict

Raises: libckan.model.exceptions.CKANError:
An error occurred accessing CKAN API
libckan.logic.action.get.activity.recently_changed_packages_activity_list(client=<libckan.model.client.Client object>, offset='', limit='')

Return the activity stream of all recently added or changed packages.

Parameters:
  • client (libckan.model.client.Client) – the CKAN Client. Default: an instance of libckan.model.client.Client
  • offset (int) – where to start getting activity items from (optional, default: 0)
  • limit (int) – the maximum number of activities to return (optional, default: 31, the default value is configurable via the ckan.activity_list_limit setting)
Return type:

list of dictionaries

Returns:

the dictionary returned by the CKAN API, with the keys “help”,”result”, and “success”. “results” is a list of packages (dict).

Returns:

dict

Raises: libckan.model.exceptions.CKANError:
An error occurred accessing CKAN API
libckan.logic.action.get.activity.recently_changed_packages_activity_list_html(client=<libckan.model.client.Client object>, offset='', limit='')

Return the activity stream of all recently changed packages as HTML.

The activity stream includes all recently added or changed packages. It is rendered as a snippet of HTML meant to be included in an HTML page, i.e. it doesn’t have any HTML header or footer.

Parameters:
  • client (libckan.model.client.Client) – the CKAN Client. Default: an instance of libckan.model.client.Client
  • offset (int) – where to start getting activity items from (optional, default: 0)
  • limit (int) – the maximum number of activities to return (optional, default: 31, the default value is configurable via the ckan.activity_list_limit setting)
Return type:

string

Returns:

the dictionary returned by the CKAN API, with the keys “help”,”result”, and “success”. “results” is a list of packages (dict).

Returns:

dict

Raises: libckan.model.exceptions.CKANError:
An error occurred accessing CKAN API
libckan.logic.action.get.activity.user_activity_list(client=<libckan.model.client.Client object>, id='', offset='', limit='')

Return a user’s public activity stream.

You must be authorized to view the user’s profile.

Parameters:
  • client (libckan.model.client.Client) – the CKAN Client. Default: an instance of libckan.model.client.Client
  • 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, the default value is configurable via the ckan.activity_list_limit setting)
Return type:

list of dictionaries

Returns:

the dictionary returned by the CKAN API, with the keys “help”,”result”, and “success”. “results” is a list of packages (dict).

Returns:

dict

Raises: libckan.model.exceptions.CKANError:
An error occurred accessing CKAN API
libckan.logic.action.get.activity.user_activity_list_html(client=<libckan.model.client.Client object>, id='', offset='', limit='')

Return a user’s public activity stream as HTML.

The activity stream is rendered as a snippet of HTML meant to be included in an HTML page, i.e. it doesn’t have any HTML header or footer.

Parameters:
  • client (libckan.model.client.Client) – the CKAN Client. Default: an instance of libckan.model.client.Client
  • 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, the default value is configurable via the ckan.activity_list_limit setting)
Return type:

string

Returns:

the dictionary returned by the CKAN API, with the keys “help”,”result”, and “success”. “results” is a list of packages (dict).

Returns:

dict

Raises: libckan.model.exceptions.CKANError:
An error occurred accessing CKAN API

follow Module

group Module

libckan.logic.action.get.group.group_list(client=<libckan.model.client.Client object>, order_by='', sort='', groups='', all_fields='')

Return a list of the names of the site’s groups.

Parameters:
  • client (libckan.model.client.Client) – the CKAN Client. Default: an instance of libckan.model.client.Client
  • 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: “name asc” string of field name and sort-order. The allowed fields are ‘name’ and ‘packages’
  • 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 (boolean) – return full group dictionaries instead of just names (optional, default: False)
Return type:

list of strings

Returns:

the dictionary returned by the CKAN API, with the keys “help”,”result”, and “success”. “results” is a list of packages (dict).

Returns:

dict

Raises: libckan.model.exceptions.CKANError:
An error occurred accessing CKAN API
libckan.logic.action.get.group.group_list_authz(client=<libckan.model.client.Client object>, available_only='')

Return the list of groups that the user is authorized to edit.

Parameters:
  • client (libckan.model.client.Client) – the CKAN Client. Default: an instance of libckan.model.client.Client
  • available_only (boolean) – remove the existing groups in the package (optional, default: False)
Returns:

the names of groups that the user is authorized to edit

Return type:

list of strings

Returns:

the dictionary returned by the CKAN API, with the keys “help”,”result”, and “success”. “results” is a list of packages (dict).

Returns:

dict

Raises: libckan.model.exceptions.CKANError:
An error occurred accessing CKAN API
libckan.logic.action.get.group.group_show(client=<libckan.model.client.Client object>, id='')

Return the details of a group.

Parameters:
  • client (libckan.model.client.Client) – the CKAN Client. Default: an instance of libckan.model.client.Client
  • id (string) – the id or name of the group
Return type:

dictionary

Returns:

the dictionary returned by the CKAN API, with the keys “help”,”result”, and “success”. “results” is a list of packages (dict).

Returns:

dict

Raises: libckan.model.exceptions.CKANError:
An error occurred accessing CKAN API

misc Module

libckan.logic.action.get.misc.licence_list(client=<libckan.model.client.Client object>)

Return the list of licenses available for datasets on the site.

Return type:list of dictionaries
Parameters:client (libckan.model.client.Client) – the CKAN Client. Default: an instance of libckan.model.client.Client
Returns:the dictionary returned by the CKAN API, with the keys “help”,”result”, and “success”. “results” is a list of packages (dict).
Returns:dict
Raises: libckan.model.exceptions.CKANError:
An error occurred accessing CKAN API
libckan.logic.action.get.misc.site_read(client=<libckan.model.client.Client object>)

Return True.

Return type:boolean
Parameters:client (libckan.model.client.Client) – the CKAN Client. Default: an instance of libckan.model.client.Client
Returns:the dictionary returned by the CKAN API, with the keys “help”,”result”, and “success”. “results” is a list of packages (dict).
Returns:dict
Raises: libckan.model.exceptions.CKANError:
An error occurred accessing CKAN API

organization Module

libckan.logic.action.get.organization.organization_list(client=<libckan.model.client.Client object>, order_by='', sort='', organizations='', all_fields='')

Return a list of the names of the site’s organizations.

Parameters:
  • client (libckan.model.client.Client) – the CKAN Client. Default: an instance of libckan.model.client.Client
  • 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: “name asc” string of field name and sort-order. The allowed fields are ‘name’ and ‘packages’
  • 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 (boolean) – return full group dictionaries instead of just names (optional, default: False)
Return type:

list of strings

Returns:

the dictionary returned by the CKAN API, with the keys “help”,”result”, and “success”. “results” is a list of packages (dict).

Returns:

dict

Raises: libckan.model.exceptions.CKANError:
An error occurred accessing CKAN API
libckan.logic.action.get.organization.organization_list_for_user(client=<libckan.model.client.Client object>, permission='')

Return the list of organizations that the user is a member of.

Parameters:
  • client (libckan.model.client.Client) – the CKAN Client. Default: an instance of libckan.model.client.Client
  • permission (string) – the permission the user has against the returned organizations (optional, default: edit_group)
Returns:

the names of organizations the user is authorized to do specific permission

Return type:

list of strings

Returns:

the dictionary returned by the CKAN API, with the keys “help”,”result”, and “success”. “results” is a list of packages (dict).

Returns:

dict

Raises: libckan.model.exceptions.CKANError:
An error occurred accessing CKAN API
libckan.logic.action.get.organization.organization_show(client=<libckan.model.client.Client object>, id='')

Return the details of a organization.

Parameters:
  • client (libckan.model.client.Client) – the CKAN Client. Default: an instance of libckan.model.client.Client
  • id (string) – the id or name of the organization
Return type:

dictionary

Returns:

the dictionary returned by the CKAN API, with the keys “help”,”result”, and “success”. “results” is a list of packages (dict).

Returns:

dict

Raises: libckan.model.exceptions.CKANError:
An error occurred accessing CKAN API

package Module

libckan.logic.action.get.package.current_package_list_with_resources(client=<libckan.model.client.Client object>, limit='', page='')

Return a list of the site’s datasets (packages) and their resources.

The list is sorted most-recently-modified first.

Parameters:
  • client (libckan.model.client.Client) – the CKAN Client. Default: an instance of libckan.model.client.Client
  • 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)
  • page (int) – when limit is given, which page to return
Return type:

list of dictionaries

Returns:

the dictionary returned by the CKAN API, with the keys “help”,”result”, and “success”. “results” is a list of packages (dict).

Returns:

dict

Raises: libckan.model.exceptions.CKANError:
An error occurred accessing CKAN API
libckan.logic.action.get.package.group_package_show(client=<libckan.model.client.Client object>, id='', limit='')

Return the datasets (packages) of a group.

Parameters:
  • client (libckan.model.client.Client) – the CKAN Client. Default: an instance of libckan.model.client.Client
  • id (string) – the id or name of the group
  • limit (int) – the maximum number of datasets to return (optional)
Return type:

list of dictionaries

Returns:

the dictionary returned by the CKAN API, with the keys “help”,”result”, and “success”. “results” is a list of packages (dict).

Returns:

dict

Raises: libckan.model.exceptions.CKANError:
An error occurred accessing CKAN API
libckan.logic.action.get.package.package_autocomplete(client=<libckan.model.client.Client object>, q='')

Return a list of datasets (packages) that match a string.

Datasets with names or titles that contain the query string will be returned.

Parameters:
  • client (libckan.model.client.Client) – the CKAN Client. Default: an instance of libckan.model.client.Client
  • q (string) – the string to search for
Return type:

list of dictionaries

Returns:

the dictionary returned by the CKAN API, with the keys “help”,”result”, and “success”. “results” is a list of packages (dict).

Returns:

dict

Raises: libckan.model.exceptions.CKANError:
An error occurred accessing CKAN API
libckan.logic.action.get.package.package_list(client=<libckan.model.client.Client object>)

Return a list of the names of the site’s datasets (packages).

Return type:list of strings
Parameters:client (libckan.model.client.Client) – the CKAN Client. Default: an instance of libckan.model.client.Client
Returns:A list of names of the packages.
Returns:[str]
Raises: libckan.model.exceptions.CKANError:
An error occurred accessing CKAN API
libckan.logic.action.get.package.package_relationships_list(client=<libckan.model.client.Client object>, id='', id2='', rel='')

Return a dataset (package)’s relationships.

Parameters:
  • client (libckan.model.client.Client) – the CKAN Client. Default: an instance of libckan.model.client.Client
  • id (string) – the id or name of the package
  • id2
  • rel
Return type:

list of dictionaries

Returns:

the dictionary returned by the CKAN API, with the keys “help”,”result”, and “success”. “results” is a list of packages (dict).

Returns:

dict

Raises: libckan.model.exceptions.CKANError:
An error occurred accessing CKAN API

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:
  • client (libckan.model.client.Client) – the CKAN Client. Default: an instance of libckan.model.client.Client
  • 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.
  • rows (int) – the number of matching rows to return.
  • sort (string) – sorting of the search results. Optional. Default: “score desc, name asc”. As per the solr documentation, this is a comma-separated string of field names and sort-orderings.
  • start (int) – the offset in the complete result for where the set of returned datasets should begin.
  • qf (string) – the dismax query fields to search within, including boosts. See the Solr Dismax Documentation for further details.
  • facet (string) – whether to enable faceted results. Default: “true”.
  • facet.mincount (int) – the minimum counts for facet fields should be included in the results.
  • facet.limit (int) – the maximum number of constraint counts that should be returned for the facet fields. A negative value means unlimited
  • facet.field (list of strings) – the fields to facet upon. Default empty. If empty, then the returned facet information is empty.
Returns:

the dictionary returned by the CKAN API, with the keys “help”,”result”, and “success”. “results” is a list of packages (dict).

Returns:

dict

Results:

The result of this action is a dict with the following keys:

Return type:

A dictionary with the following keys

Parameters:
  • count (int) – the number of results found. Note, this is the total number of results found, not the total number of results returned (which is affected by limit and row parameters used in the input).
  • results (list of dictized datasets.) – ordered list of datasets matching the query, where the ordering defined by the sort parameter used in the query.
  • facets (DEPRECATED dict) – DEPRECATED. Aggregated information about facet counts.
  • search_facets (nested dict of dicts.) – aggregated information about facet counts. The outer dict is keyed by the facet field name (as used in the search query). Each entry of the outer dict is itself a dict, with a “title” key, and an “items” key. The “items” key’s value is a list of dicts, each with “count”, “display_name” and “name” entries. The display_name is a form of the name that can be used in titles.

An example result:

{'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 cannot be changed. CKAN always returns the matched datasets as dictionary objects.
Raises: libckan.model.exceptions.CKANError:
An error occurred accessing CKAN API
libckan.logic.action.get.package.package_show(client=<libckan.model.client.Client object>, id='')

Return the metadata of a dataset (package) and its resources.

Parameters:
  • client (libckan.model.client.Client) – the CKAN Client. Default: an instance of libckan.model.client.Client
  • id (string) – the id or name of the dataset
Return type:

dictionary

Returns:

the dictionary returned by the CKAN API, with the keys “help”,”result”, and “success”. “results” is a list of packages (dict).

Returns:

dict

Raises: libckan.model.exceptions.CKANError:
An error occurred accessing CKAN API

related Module

libckan.logic.action.get.related.related_list(client=<libckan.model.client.Client object>, id='', dataset='', type_filter='', sort='', featured='')

Return a dataset’s related items.

Either the id or the dataset parameter must be given.

Parameters:
  • client (libckan.model.client.Client) – the CKAN Client. Default: an instance of libckan.model.client.Client
  • id (string) – id or name of the dataset (optional)
  • dataset (dictionary) – dataset dictionary of the dataset (optional)
  • type_filter (string) – the type of related item to show (optional, default: None, show all items)
  • sort (string) – the order to sort the related items in, possible values are ‘view_count_asc’, ‘view_count_desc’, ‘created_asc’ or ‘created_desc’ (optional)
  • featured (bool) – whether or not to restrict the results to only featured related items (optional, default: False)
Return type:

list of dictionaries

Returns:

the dictionary returned by the CKAN API, with the keys “help”,”result”, and “success”. “results” is a list of packages (dict).

Returns:

dict

Raises: libckan.model.exceptions.CKANError:
An error occurred accessing CKAN API
libckan.logic.action.get.related.related_show(client=<libckan.model.client.Client object>, id='')

Return a single related item.

Parameters:
  • client (libckan.model.client.Client) – the CKAN Client. Default: an instance of libckan.model.client.Client
  • id (string) – the id of the related item to show
Return type:

dictionary

Returns:

the dictionary returned by the CKAN API, with the keys “help”,”result”, and “success”. “results” is a list of packages (dict).

Returns:

dict

Raises: libckan.model.exceptions.CKANError:
An error occurred accessing CKAN API

resource Module

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 Resource.hash 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"

Then a json blob with the string representation of:

{"field1": "foo", "field2": "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:
  • client (libckan.model.client.Client) – the CKAN Client. Default: an instance of libckan.model.client.Client
  • 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

Returns:

the dictionary returned by the CKAN API, with the keys “help”,”result”, and “success”. “results” is a list of packages (dict).

Returns:

dict

Raises: libckan.model.exceptions.CKANError:
An error occurred accessing CKAN API
libckan.logic.action.get.resource.resource_show(client=<libckan.model.client.Client object>, id='')

Return the metadata of a resource.

Parameters:
  • client (libckan.model.client.Client) – the CKAN Client. Default: an instance of libckan.model.client.Client
  • id (string) – the id of the resource
Return type:

dictionary

Returns:

the dictionary returned by the CKAN API, with the keys “help”,”result”, and “success”. “results” is a list of packages (dict).

Returns:

dict

Raises: libckan.model.exceptions.CKANError:
An error occurred accessing CKAN API

revision Module

libckan.logic.action.get.revision.group_revision_list(client=<libckan.model.client.Client object>, id='')

Return a group’s revisions.

Parameters:
  • client (libckan.model.client.Client) – the CKAN Client. Default: an instance of libckan.model.client.Client
  • id (string) – the name or id of the group
Return type:

list of dictionaries

Returns:

the dictionary returned by the CKAN API, with the keys “help”,”result”, and “success”. “results” is a list of packages (dict).

Returns:

dict

Raises: libckan.model.exceptions.CKANError:
An error occurred accessing CKAN API
libckan.logic.action.get.revision.package_revision_list(client=<libckan.model.client.Client object>, id='')

Return a dataset (package)’s revisions as a list of dictionaries.

Parameters:
  • client (libckan.model.client.Client) – the CKAN Client. Default: an instance of libckan.model.client.Client
  • id (string) – the id or name of the dataset
Returns:

the dictionary returned by the CKAN API, with the keys “help”,”result”, and “success”. “results” is a list of packages (dict).

Returns:

dict

Raises: libckan.model.exceptions.CKANError:
An error occurred accessing CKAN API
libckan.logic.action.get.revision.revision_list(client=<libckan.model.client.Client object>)

Return a list of the IDs of the site’s revisions.

Return type:list of strings
Parameters:client (libckan.model.client.Client) – the CKAN Client. Default: an instance of libckan.model.client.Client
Returns:the dictionary returned by the CKAN API, with the keys “help”,”result”, and “success”. “results” is a list of packages (dict).
Returns:dict
Raises: libckan.model.exceptions.CKANError:
An error occurred accessing CKAN API
libckan.logic.action.get.revision.revision_show(client=<libckan.model.client.Client object>, id='')

Return the details of a revision.

Parameters:
  • client (libckan.model.client.Client) – the CKAN Client. Default: an instance of libckan.model.client.Client
  • id (string) – the id of the revision
Return type:

dictionary

Returns:

the dictionary returned by the CKAN API, with the keys “help”,”result”, and “success”. “results” is a list of packages (dict).

Returns:

dict

Raises: libckan.model.exceptions.CKANError:
An error occurred accessing CKAN API

roles Module

libckan.logic.action.get.roles.member_roles_list(client=<libckan.model.client.Client object>)

<TODO: DESCRIPTION>

Parameters:client (libckan.model.client.Client) – the CKAN Client. Default: an instance of libckan.model.client.Client

<TODO: PARAMETERS>

Returns:the dictionary returned by the CKAN API, with the keys “help”,”result”, and “success”. “results” is a list of packages (dict).
Returns:dict
Raises: libckan.model.exceptions.CKANError:
An error occurred accessing CKAN API
libckan.logic.action.get.roles.roles_show(client=<libckan.model.client.Client object>, domain_object='', user='')

Return the roles of all users and authorization groups for an object.

Parameters:
  • client (libckan.model.client.Client) – the CKAN Client. Default: an instance of libckan.model.client.Client
  • domain_object (string) – a package or group name or id to filter the results by
  • user (string) – a user name or id
Return type:

list of dictionaries

Returns:

the dictionary returned by the CKAN API, with the keys “help”,”result”, and “success”. “results” is a list of packages (dict).

Returns:

dict

Raises: libckan.model.exceptions.CKANError:
An error occurred accessing CKAN API

status Module

libckan.logic.action.get.status.resource_status_show(client=<libckan.model.client.Client object>, id='')

Return the statuses of a resource’s tasks.

Parameters:
  • client (libckan.model.client.Client) – the CKAN Client. Default: an instance of libckan.model.client.Client
  • id (string) – the id of the resource
Return type:

list of (status, date_done, traceback, task_status) dictionaries

Returns:

the dictionary returned by the CKAN API, with the keys “help”,”result”, and “success”. “results” is a list of packages (dict).

Returns:

dict

Raises: libckan.model.exceptions.CKANError:
An error occurred accessing CKAN API
libckan.logic.action.get.status.status_show(client=<libckan.model.client.Client object>)

Return a dictionary with information about the site’s configuration

Parameters:client (libckan.model.client.Client) – the CKAN Client. Default: an instance of libckan.model.client.Client

.

Returns:the dictionary returned by the CKAN API, with the keys “help”,”result”, and “success”. “results” is a list of packages (dict).
Returns:dict
Raises: libckan.model.exceptions.CKANError:
An error occurred accessing CKAN API
libckan.logic.action.get.status.task_status_show(client=<libckan.model.client.Client object>, id='', entity_id='', task_type='', key='')

Return a task status.

Either the id parameter or the entity_id, task_type and key parameters must be given.

Parameters:
  • client (libckan.model.client.Client) – the CKAN Client. Default: an instance of libckan.model.client.Client
  • id (string) – the id of the task status (optional)
  • entity_id (string) – the entity_id of the task status (optional)
  • task_type – the task_type of the task status (optional)
  • key (string) – the key of the task status (optional)
Return type:

dictionary

Returns:

the dictionary returned by the CKAN API, with the keys “help”,”result”, and “success”. “results” is a list of packages (dict).

Returns:

dict

Raises: libckan.model.exceptions.CKANError:
An error occurred accessing CKAN API

tag Module

libckan.logic.action.get.tag.tag_autocomplete(client=<libckan.model.client.Client object>, query='', vocabulary_id='', fields='', limit='', offset='')

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:
  • client (libckan.model.client.Client) – the CKAN Client. Default: an instance of libckan.model.client.Client
  • 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

Returns:

the dictionary returned by the CKAN API, with the keys “help”,”result”, and “success”. “results” is a list of packages (dict).

Returns:

dict

Raises: libckan.model.exceptions.CKANError:
An error occurred accessing CKAN API
libckan.logic.action.get.tag.tag_list(client=<libckan.model.client.Client object>, query='', vocabulary_id='', all_fields='')

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 argument is given then only tags belonging to that vocabulary will be returned instead.

Parameters:
  • client (libckan.model.client.Client) – the CKAN Client. Default: an instance of libckan.model.client.Client
  • 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 (boolean) – return full tag dictionaries instead of just names (optional, default: False)
Return type:

list of dictionaries

Returns:

the dictionary returned by the CKAN API, with the keys “help”,”result”, and “success”. “results” is a list of packages (dict).

Returns:

dict

Raises: libckan.model.exceptions.CKANError:
An error occurred accessing CKAN API

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:
  • client (libckan.model.client.Client) – the CKAN Client. Default: an instance of libckan.model.client.Client
  • 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

Returns:

the dictionary returned by the CKAN API, with the keys “help”,”result”, and “success”. “results” is a list of packages (dict).

Returns:

dict

Raises: libckan.model.exceptions.CKANError:
An error occurred accessing CKAN API
libckan.logic.action.get.tag.tag_show(client=<libckan.model.client.Client object>, id='')

Return the details of a tag and all its datasets.

Parameters:
  • client (libckan.model.client.Client) – the CKAN Client. Default: an instance of libckan.model.client.Client
  • id (string) – the name or id of the tag
Returns:

the details of the tag, including a list of all of the tag’s datasets and their details

Return type:

dictionary

Returns:

the dictionary returned by the CKAN API, with the keys “help”,”result”, and “success”. “results” is a list of packages (dict).

Returns:

dict

Raises: libckan.model.exceptions.CKANError:
An error occurred accessing CKAN API

term Module

libckan.logic.action.get.term.format_autocomplete(client=<libckan.model.client.Client object>, q='', limit='')

Return a list of resource formats whose names contain a string.

Parameters:
  • client (libckan.model.client.Client) – the CKAN Client. Default: an instance of libckan.model.client.Client
  • 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

Returns:

the dictionary returned by the CKAN API, with the keys “help”,”result”, and “success”. “results” is a list of packages (dict).

Returns:

dict

Raises: libckan.model.exceptions.CKANError:
An error occurred accessing CKAN API
libckan.logic.action.get.term.term_translation_show(client=<libckan.model.client.Client object>, terms='', lang_codes='')

Return the translations for the given term(s) and language(s).

Parameters:
  • client (libckan.model.client.Client) – the CKAN Client. Default: an instance of libckan.model.client.Client
  • 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)

Returns:

the dictionary returned by the CKAN API, with the keys “help”,”result”, and “success”. “results” is a list of packages (dict).

Returns:

dict

Raises: libckan.model.exceptions.CKANError:
An error occurred accessing CKAN API
libckan.logic.action.get.term.vocabulary_list(client=<libckan.model.client.Client object>)

Return a list of all the site’s tag vocabularies.

Return type:list of dictionaries
Parameters:client (libckan.model.client.Client) – the CKAN Client. Default: an instance of libckan.model.client.Client
Returns:the dictionary returned by the CKAN API, with the keys “help”,”result”, and “success”. “results” is a list of packages (dict).
Returns:dict
Raises: libckan.model.exceptions.CKANError:
An error occurred accessing CKAN API
libckan.logic.action.get.term.vocabulary_show(client=<libckan.model.client.Client object>, id='')

Return a single tag vocabulary.

Parameters:
  • client (libckan.model.client.Client) – the CKAN Client. Default: an instance of libckan.model.client.Client
  • id (string) – the id or name of the vocabulary
Returns:

the vocabulary.

Return type:

dictionary

Returns:

the dictionary returned by the CKAN API, with the keys “help”,”result”, and “success”. “results” is a list of packages (dict).

Returns:

dict

Raises: libckan.model.exceptions.CKANError:
An error occurred accessing CKAN API

user Module

libckan.logic.action.get.user.member_list(client=<libckan.model.client.Client object>, id='', object_type='', capacity='')

Return the members of a group.

The user must have permission to ‘get’ the group.

Parameters:
  • client (libckan.model.client.Client) – the CKAN Client. Default: an instance of libckan.model.client.Client
  • 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

Returns:

the dictionary returned by the CKAN API, with the keys “help”,”result”, and “success”. “results” is a list of packages (dict).

Returns:

dict

Raises: libckan.model.exceptions.CKANError:
An error occurred accessing CKAN API
libckan.logic.action.get.user.user_autocomplete(client=<libckan.model.client.Client object>, q='', limit='')

Return a list of user names that contain a string.

Parameters:
  • client (libckan.model.client.Client) – the CKAN Client. Default: an instance of libckan.model.client.Client
  • 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'

Returns:

the dictionary returned by the CKAN API, with the keys “help”,”result”, and “success”. “results” is a list of packages (dict).

Returns:

dict

Raises: libckan.model.exceptions.CKANError:
An error occurred accessing CKAN API
libckan.logic.action.get.user.user_list(client=<libckan.model.client.Client object>, q='', order_by='')

Return a list of the site’s user accounts.

Parameters:
  • client (libckan.model.client.Client) – the CKAN Client. Default: an instance of libckan.model.client.Client
  • q (string) – restrict the users returned to those whose names contain a string (optional)
  • order_by (string) – which field to sort the list by (optional, default: 'name')
Return type:

list of dictionaries

Returns:

the dictionary returned by the CKAN API, with the keys “help”,”result”, and “success”. “results” is a list of packages (dict).

Returns:

dict

Raises: libckan.model.exceptions.CKANError:
An error occurred accessing CKAN API
libckan.logic.action.get.user.user_show(client=<libckan.model.client.Client object>, id='', user_obj='')

Return a user account.

Either the id or the user_obj parameter must be given.

Parameters:
  • client (libckan.model.client.Client) – the CKAN Client. Default: an instance of libckan.model.client.Client
  • id (string) – the id or name of the user (optional)
  • user_obj (user dictionary) – the user dictionary of the user (optional)
Return type:

dictionary

Returns:

the dictionary returned by the CKAN API, with the keys “help”,”result”, and “success”. “results” is a list of packages (dict).

Returns:

dict

Raises: libckan.model.exceptions.CKANError:
An error occurred accessing CKAN API