GET /api/v1/compare
Compare one resource across multiple cities
Compares ONE resource across multiple cities (comma-separated) in a single response. Each city carries its own source_status (ok/disabled/no_data/error/not_found); a missing or dead city source does not cause an overall 5xx but is reported honestly per city. resource is checked against a fixed list (unknown -> 400). Besides weather/air, indicators, demographics, unemployment, tourism, charging-status and weather-warnings can be compared as well. The result is paginated (page/limit/offset/sort).
Parameters
| Name | In | Required | Type | Example | Description |
|---|---|---|---|---|---|
cities | query | yes | string | berlin,koeln,hamburg | Comma-separated city slugs (limited to MAX_CITIES). |
resource | query | yes | string | Resource to compare; unknown -> 400 invalid_request. weather/air = live adapters (DWD/UBA); indicators, demographics, unemployment, tourism, charging-status and weather-warnings delegate to the per-city endpoints (identical behaviour incl. attribution). charging-status returns aggregates only in compare (points_omitted instead of the point list). | |
page | query | no | integer | 1 | |
limit | query | no | integer | 50 | |
offset | query | no | integer | 0 | |
sort | query | no | string | ||
order | query | no | string | asc | |
If-None-Match | header | no | string | Conditional GET; If-None-Match == ETag -> 304 Not Modified with no body. |
Code samples
curl "https://infranode.dev/api/v1/compare?cities=berlin%2Ckoeln%2Chamburg&resource=weather"const res = await fetch("https://infranode.dev/api/v1/compare?cities=berlin%2Ckoeln%2Chamburg&resource=weather");
const data = await res.json();
console.log(data);import httpx
res = httpx.get("https://infranode.dev/api/v1/compare?cities=berlin%2Ckoeln%2Chamburg&resource=weather")
res.raise_for_status()
print(res.json())