Overview¶
The GDEX REST API provides programmatic access to dataset discovery, metadata, subset requests, and file downloads. This can be useful when automating workflows or programatically searching for data. This notebook introduces the API conventions, authentication, and the standard response envelope.
Understand the base URL and endpoint structure
Learn the standard JSON response envelope
Authenticate with a token
Make your first API call
Documentation¶
The first and most important resource you should take a look at is the full documentation found on the
From here, you can see examples and descriptions of each endpoint.
Prerequisites¶
| Concepts | Importance | Notes |
|---|---|---|
| HTTP basics | Helpful | GET/POST, status codes |
| requests library | Necessary | Python HTTP client |
| JSON | Helpful | Parsing responses |
Time to learn: 15 minutes
Imports¶
import requests
import jsonAPI Conventions¶
All endpoints live under https://gdex.ucar.edu/api/. Dataset IDs use the format d###### (six digits). Every successful response follows this envelope returned in JSON format:
{
"status": "ok",
"http_response": 200,
"error_messages": [],
"contact": "datahelp@ucar.edu",
"data": { ... }
}BASE_URL = "https://gdex.ucar.edu"Authentication¶
Most read endpoints are public and do NOT require authentication. However, Subset and purge endpoints require authentication via:
Token:
?token=<your_token>— get yours athttps://gdex.ucar.edu/accounts/profile/
Your First API Call¶
GET /api/datasets/ lists all available datasets with their IDs and titles.
# list all datasets
all_datasets_url = f"{BASE_URL}/api/datasets/"
resp = requests.get(all_datasets_url)
envelope = resp.json()
print(envelope["data"]["count"], "datasets")
for ds in envelope["data"]["datasets"][:5]:
print(ds["id"], "—", ds["title"])1739 datasets
d010000 — Daily Northern Hemisphere Sea Level Pressure Grids, continuing from 1899
d010001 — Monthly Northern Hemisphere Sea-Level Pressure Grids, continuing from 1899
d010008 —
d010014 — SUMMA Hydrology in the Pacific Northwest for Hydrologic System Vulnerability Assessments
d010018 — Atmospheric Potential Oxygen forward Model Intercomparison Project (APO-MIP)
Summary¶
The GDEX API follows a consistent REST pattern: GET https://gdex.ucar.edu/api/<endpoint>/. Public endpoints need no auth; subset and purge endpoints require a token from your GDEX profile.