How action shortcuts and call_action work
masterThe .action object on a RemoteCKAN or LocalCKAN instance provides a dynamic interface to the CKAN Action API.
- Action Shortcuts: Calling
demo.action.method_name(param=value)automatically maps to a CKAN action. This works for all standard CKAN actions and actions added by plugins (e.g.,demo.action.ckanext_showcase_list()). - call_action: The explicit method
demo.call_action('method_name', {params})achieves the same result and is useful when method names are dynamic.
Both approaches support complex query parameters, such as those used in package_search with SOLR syntax.
# Action shortcut
packages = demo.action.package_search(q='+organization:sample-org +tags:geojson')
# Explicit call
packages = demo.call_action('package_search', {'q': '+organization:sample-org +tags:geojson'})