API docs

Read-only demo access to the same station/reading data behind the dashboard — REST, GraphQL, and a raw HTTP echo endpoint for testing your own client.

REST

GET /api/stations — all monitoring stations.

GET /api/stations/<slug> — a single station.

GET /api/readings?station=<slug>&metric=<metric>&limit=<n> — recent readings, newest first. All query params optional.

curl https://watershed-insight.com/api/stations

GraphQL

POST /api/graphql — standard GraphQL-over-HTTP: JSON body {"query": "...", "variables": {...}}.

curl -X POST https://watershed-insight.com/api/graphql \
  -H "Content-Type: application/json" \
  -d '{"query": "{ stations { slug name riverBasin status } }"}'

HTTP echo

/api/echo — accepts any method; returns the method, headers, query string, and body it received. Useful for testing an HTTP client or CORS behavior against a known target.

A note on this demo API's CORS policy

This API is intentionally configured with a permissive Access-Control-Allow-Origin: * combined with Access-Control-Allow-Credentials: true — a real, invalid/dangerous combination browsers should reject credentialed requests for. It's here on purpose, as one of this site's demo misconfigurations.