POST
/api/data
Send sensor data from ESP32 to the server.
ESP32 JSON body:
{
"temperature": 24.6,
"humidity": 24.9,
"airQuality": 487,
"luminosity": 1
}
Required: temperature, humidity, airQuality. Optional: luminosity.
Response JSON:
{
"status": "success",
"message": "Data received and saved",
"id": 123,
"clientsNotified": 2,
"timestamp": "2026-04-01 12:50:35"
}
GET
/api/data
Get paginated sensor data. Query params: page, limit.
GET
/api/data/latest
Get the newest single reading.
GET
/api/data/history?range=24h|7d|30d
Get historical chart data for the selected range.
GET
/api/data/initial
Get the initial dashboard payload: latest reading, 24h history, and summary.
GET
/api/data/export
Download CSV. Use ?range=24h, ?range=7d, ?range=30d, or custom startDate and endDate.
GET
/api/settings
Read shared app settings used by all devices.
POST
/api/settings
Save shared settings for everyone.
{
"defaultRange": "24h",
"logLimit": 10,
"dbPageSize": 50,
"weatherLocation": "kaunas",
"weatherRefresh": "10m"
}
DELETE
/api/database
Delete database records. Use ?scope=all, ?scope=older-than&days=30, or ?scope=range&startDate=...&endDate=....
GET
/api/database/stats
Get record counts and database date range.