Using Command Line Tools to Access the CKAN API
Command-line tools let you test CKAN endpoints quickly without writing scripts.
They’re ideal for exploring datasets, checking parameters, and debugging queries.
HTTPie
HTTPie is a user‑friendly command‑line HTTP client.
It provides color‑coded, structured JSON output, making responses easier to read.
Basic usage pattern:
HTTPie Examples
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:
Example JSON response (trimmed):
{
"help": "https://canwin-datahub.ad.umanitoba.ca/data/api/3/action/help_show?name=group_list",
"result": [
"modelling",
"cryosphere",
"freshwater",
"marine",
"remote-sensing"
],
"success": true
}
cURL
cURL is a widely available command‑line tool for HTTP requests.
It outputs raw JSON (no color‑coding), but is preinstalled on most systems.
Basic usage pattern:
cURL Examples
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:
HTTPie vs cURL
| Tool | Pros | Cons |
|---|---|---|
| HTTPie | Pretty JSON, simpler syntax | Requires installation |
| cURL | Preinstalled on most systems | Raw, less readable |
Authentication
Some API functions require an API key.
Include it in your request using the Authorization header: