# Car Log API Simple car on/off event logging system with interval analysis. ## Endpoints ### `GET /` Returns this documentation. ### `GET /on?psw=PASSWORD` Log a car "on" event with current timestamp. **Response:** ```json { "success": true, "timestamp": "2025-08-25 14:30:00", "event": "on" } ``` ### `GET /off?psw=PASSWORD` Log a car "off" event with current timestamp. **Response:** ```json { "success": true, "timestamp": "2025-08-25 16:45:00", "event": "off" } ``` ### `GET /intervals?psw=PASSWORD[&start-date=YYYY-MM-DD][&end-date=YYYY-MM-DD]` Analyze car usage intervals with optional date filtering. **Query Parameters:** - `start-date` (optional): Filter intervals from this date (YYYY-MM-DD format) - `end-date` (optional): Filter intervals until this date (YYYY-MM-DD format) **Features:** - Pairs "on" and "off" events into usage intervals - Splits intervals crossing midnight (00:00 Czech time) - Caps single rides at maximum 6 hours - Returns intervals sorted by start time **Response:** ```json [ { "start": "2025-08-25 14:30:00", "end": "2025-08-25 16:45:00", "duration": 2.25 }, { "start": "2025-08-25 23:30:00", "end": "2025-08-25 23:59:59", "duration": 0.5 }, { "start": "2025-08-26 00:00:00", "end": "2025-08-26 01:30:00", "duration": 1.5 } ] ``` ## Data Storage - Events are stored in CSV format: `timestamp,event` - All timestamps are in Czech local time (CET/CEST) - Data persists across server restarts ## Error Responses ```json { "success": false, "error": "Unauthorized" } ``` ```json { "success": false, "error": "Invalid start-date format. Use yyyy-mm-dd" } ```