Files
AquaMasterMQTT/API.md
Carsten Graf 173b13fcfc
Some checks failed
/ build (push) Has been cancelled
add settings locations
2025-09-08 22:30:15 +02:00

93 lines
4.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# API Documentation: AquaMaster Webserver
This document describes all available API routes provided by the webserver in `webserverrouter.h`.
All API endpoints return JSON unless otherwise noted.
---
## Static Files
| Route | Method | Description | Response Type |
|------------------|--------|------------------------------|--------------|
| `/` | GET | Main page | HTML |
| `/settings` | GET | Settings page | HTML |
| `/rfid` | GET | RFID page | HTML |
| `/firmware.bin` | GET | Firmware file (SPIFFS) | Binary |
---
## Timer & Data
| Route | Method | Description | Request Body/Params | Response Example |
|-------------------|--------|-------------------------------------|--------------------|------------------|
| `/api/data` | GET | Get current timer and status data | | `{...}` |
| `/api/reset-best` | POST | Reset best times | | `{ "success": true }` |
---
## Button Learning
| Route | Method | Description | Request Body/Params | Response Example |
|------------------------|--------|-------------------------------------|--------------------|------------------|
| `/api/unlearn-button` | POST | Remove all button assignments | | `{ "success": true }` |
| `/api/start-learning` | POST | Start button learning mode | | `{ "success": true }` |
| `/api/stop-learning` | POST | Stop button learning mode | | `{ "success": true }` |
| `/api/learn/status` | GET | Get learning mode status | | `{ "active": true, "step": 1 }` |
| `/api/buttons/status` | GET | Get button assignment and voltage | | `{ "lane1Start": true, "lane1StartVoltage": 3.3, ... }` |
---
## Settings
| Route | Method | Description | Request Body/Params | Response Example |
|----------------------|--------|-------------------------------------|--------------------|------------------|
| `/api/set-max-time` | POST | Set max timer and display time | `maxTime`, `maxTimeDisplay` (form params, seconds) | `{ "success": true }` |
| `/api/get-settings` | GET | Get current timer settings | | `{ "maxTime": 300, "maxTimeDisplay": 20 }` |
---
## WiFi Configuration
| Route | Method | Description | Request Body/Params | Response Example |
|-------------------|--------|-------------------------------------|--------------------|------------------|
| `/api/set-wifi` | POST | Set WiFi SSID and password | `ssid`, `password` (form params) | `{ "success": true }` |
| `/api/get-wifi` | GET | Get current WiFi SSID and password | | `{ "ssid": "...", "password": "..." }` |
---
## Location Configuration
| Route | Method | Description | Request Body/Params | Response Example |
|----------------------|--------|-------------------------------------|--------------------|------------------|
| `/api/set-location` | POST | Set location name and ID | `id`, `name` (form params) | `{ "success": true }` |
| `/api/get-location` | GET | Get current location | | `{ "locationid": "..." }` |
---
## Button Update & Mode
| Route | Method | Description | Request Body/Params | Response Example |
|----------------------|--------|-------------------------------------|--------------------|------------------|
| `/api/updateButtons` | GET | Trigger MQTT update for buttons | | `{ "success": true }` |
| `/api/set-mode` | POST | Set operational mode | `mode` (form param: "individual" or "wettkampf") | `{ "success": true }` |
| `/api/get-mode` | GET | Get current operational mode | | `{ "mode": "individual" }` |
---
## System Info
| Route | Method | Description | Request Body/Params | Response Example |
|---------------|--------|-------------------------------------|--------------------|------------------|
| `/api/info` | GET | Get system info (IP, MAC, memory, license, etc.) | | `{ "ip": "...", "ipSTA": "...", "channel": 1, "mac": "...", "freeMemory": 123456, "connectedButtons": 3, "isOnline": true, "valid": "Ja", "tier": 1 }` |
---
## WebSocket
| Route | Description |
|---------|------------------------------------|
| `/ws` | WebSocket endpoint for live updates|
---
**All API endpoints return JSON unless otherwise noted. POST requests expect form parameters (not JSON body).**