Skip to content

API requests using command line (CL) tools

There are several methods of making an HTTP request by using software tools or web services. Here we look at two CL tools - HTTPie and cURL.


HTTPie is a command-line HTTP client that can be used to easily access both the CKAN and DataStore endpoints. See installation instructions here.

For accessing both APIs, the command is: http the_api_endpoint.

CAKN API example

To get a list of all the themes within the CanWIN Data Catalogue, call the group_list action function by entering this command at CL:

http ''

DataStore API example

Here is an example of querying the DataStore for a certain resource by using the datastore_search action function:

http ''

The colour-coded JSON response will look like this (using the first example):

    "help": "",
    "result": [
    "success": true

This response is composed of a JSON dictionary with three keys:

  1. "help": the documentation string for the function you called, or the URL endpoint called.

  2. "result": this is the returned result from the function you called. For example, in the case of the group_list function as shown above, the result is a list of strings, which are the names of all the themes in CanWIN. 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.

  3. "success": true or false


Similarly to HTTPie, an HTTP request can be made to the CKAN API using cURL at a command line interface.

For accessing both APIs, the command is: curl the_api_endpoint.

CKAN API Example


DataStore API example


This gives the same result as HTTPie, however, the JSON output is not colour-coded or structured for easy reading.