National Park Service
This example shows how to call the National Park Service (NPS) API using the ICDC proxy. With ICDC, you do not need to manage vendor credentials. Instead, you:
- Replace the vendor hostname with the ICDC proxy hostname
- Send your ICDC token in the
X-Api-Keyheader
ICDC handles upstream authentication, metering, and logging.
Prerequisites
Section titled “Prerequisites”- An approved ICDC developer account and access to the NPS data source
- An NPS API token from ICDC
- The NPS API path you want to call (reference:
https://developer.nps.gov/api/v1/...)
See the NPS API Documentation for the full NPS documentation.
Hostname swap pattern
Section titled “Hostname swap pattern”- NPS API URL:
https://developer.nps.gov/api/v1 - ICDC proxy URL:
https://nps.api.10xicdc.com/api/v1
Keep the path and query string unchanged. Only the hostname changes.
Example mapping:
- Vendor:
https://developer.nps.gov/api/v1/parks?stateCode=CA&limit=3 - ICDC:
https://nps.api.10xicdc.com/api/v1/parks?stateCode=CA&limit=3
Set these environment variables for the snippets below:
export ICDC_PROXY_HOST="nps.api.10xicdc.com" # Found in the Data Source Developer Portalexport ICDC_TOKEN="<your-icdc-token>" # ICDC-issued NPS API keycURL: List parks in California
Section titled “cURL: List parks in California”curl -s \ -H "X-Api-Key: $ICDC_TOKEN" \ "https://$ICDC_PROXY_HOST/api/v1/parks?stateCode=CA&limit=3"How this maps to the vendor cURL
Section titled “How this maps to the vendor cURL”NPS example:
curl -H 'X-Api-Key: INSERT-API-KEY-HERE' \ 'https://developer.nps.gov/api/v1/parks?parkCode=acad'With ICDC, swap the hostname and use your ICDC-issued NPS API key:
curl -H "X-Api-Key: $ICDC_TOKEN" \ "https://$ICDC_PROXY_HOST/api/v1/parks?parkCode=acad"JavaScript (Node 18+) example
Section titled “JavaScript (Node 18+) example”const proxyHost = process.env.ICDC_PROXY_HOST;const token = process.env.ICDC_TOKEN;
async function listParks() { const url = `https://${proxyHost}/api/v1/parks?stateCode=CA&limit=3`; const res = await fetch(url, { headers: { 'X-Api-Key': token } }); if (!res.ok) { throw new Error(`Request failed: ${res.status} ${res.statusText}`); } const data = await res.json(); console.log(data);}
listParks().catch((err) => { console.error(err); process.exit(1);});Python example
Section titled “Python example”import osimport requests
proxy_host = os.environ.get("ICDC_PROXY_HOST")token = os.environ.get("ICDC_TOKEN")
url = f"https://{proxy_host}/api/v1/parks"params = {"stateCode": "CA", "limit": 3}headers = {"X-Api-Key": token}
resp = requests.get(url, params=params, headers=headers, timeout=30)resp.raise_for_status()print(resp.json())Another endpoint: Webcams
Section titled “Another endpoint: Webcams”Use the same pattern for other NPS endpoints. For example, webcams:
curl -s \ -H "X-Api-Key: $ICDC_TOKEN" \ "https://$ICDC_PROXY_HOST/api/v1/webcams?limit=2"- Do not use your ICDC token directly with the vendor API; it won’t be valid.
- Query parameters are passed through unchanged.
- Your ICDC token scopes and rate limits apply and are enforced by ICDC.
- Refer to the vendor API docs for endpoint paths and parameters.