add index endpoint

This commit is contained in:
Matthias Jacob
2026-05-05 03:54:21 +02:00
parent 883e3aa9d1
commit 9b01145f07
2 changed files with 196 additions and 2 deletions
+44
View File
@@ -46,6 +46,39 @@ Response:
}
```
Index request (all discovered stations):
```
GET /api/pegel
```
Index request with limit:
```
GET /api/pegel?limit=5
```
Index response shape:
```json
{
"count": 5,
"total_available": 312,
"items": [
{
"station_id": "560021",
"station_title": "Golzern 1 / Vereinigte Mulde",
"source": "https://www.umwelt.sachsen.de/umwelt/infosysteme/hwims/portal/web/feed/wasserstand-pegel-560021"
}
],
"source": "https://www.umwelt.sachsen.de/umwelt/infosysteme/hwims/portal/web/wasserstand-uebersicht",
"fetched_at": "2026-05-05T01:00:00+00:00",
"warnings": [
"optional, only present for partial failures"
]
}
```
---
## 🚀 Local Development
@@ -62,6 +95,7 @@ uvicorn api.app:app --reload
Open:
```
http://127.0.0.1:8000/api/pegel
http://127.0.0.1:8000/api/pegel/560021
```
@@ -109,6 +143,16 @@ Pegel ID is passed via URL:
/api/pegel/<id>
```
Index endpoint:
```
/api/pegel
```
Query params for index:
* `limit` (positive integer, optional; invalid values return HTTP 400)
---
## 📡 Data Source