You have to set the CKAN action to use, as well as the HTTP verb, in addition to any query parameters, request body data, and request headers.
Usage
ckan_action(
action,
query = NULL,
body = NULL,
headers = list(),
verb = "POST",
url = get_default_url(),
key = get_default_key(),
...
)Arguments
- action
A valid CKAN API action name (e.g.,
"package_list","package_show"). See the CKAN API documentation for a full list of actions: https://docs.ckan.org/en/latest/api/index.html- query
a named list of URL query parameters
- body
data to be used in the body of a request, see https://docs.ropensci.org/crul/reference/verb-POST.html for options
- headers
a named list of request headers
- verb
HTTP request verb, e.g., GET, POST
- url
Base url to use. Default: https://data.ontario.ca/ See also
ckanr_setup()andget_default_url()- key
A privileged CKAN API key, Default: your key set with
ckanr_setup- ...
Curl args passed on to the appropriate crul HTTP verb function (e.g., crul::verb-GET, crul::verb-POST) depending on the value of
verb(optional)
Value
a text string. because we can't know ahead of time for sure what kind of data will be returned, we return text and the user can parse as needed.
Examples
if (FALSE) { # \dontrun{
ckanr_setup(url = "https://demo.ckan.org/",
key = getOption("ckan_demo_key"))
ckan_action("package_list")
ckan_action("package_list", verb = "GET")
ckan_action("package_list", url = 'https://data.nhm.ac.uk')
} # }
