📝 Updates api documentation

This commit is contained in:
Rune Harlyk
2026-01-03 17:56:58 +01:00
committed by nikguin04
parent db0d4beb68
commit 3a393375fd
+69 -39
View File
@@ -1,44 +1,74 @@
# API
<!-- https://dev.bostondynamics.com/docs/concepts/choreography/choreography_in_tablet.html -->
The back end exposes a number of API endpoints which are referenced in the table below.
| Method | Endpoint | Authentication | POST JSON Body | Info |
| ------ | -------------------- | ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
| GET | /rest/features | `NONE_REQUIRED` | none | Tells the client which features of the UI should be use |
| GET | /rest/apStatus | `IS_AUTHENTICATED` | none | Current AP status and client information |
| GET | /rest/apSettings | `IS_ADMIN` | none | Current AP settings |
| POST | /rest/apSettings | `IS_ADMIN` | `{"provision_mode": 1,"ssid": "ESP32-SvelteKit-e89f6d20372c","password": "esp-sveltekit","channel": 1,"ssid_hidden": false,"max_clients": 4,"local_ip": "192.168.4.1","gateway_ip": "192.168.4.1","subnet_mask": "255.255.255.0"}` | Update AP settings |
| GET | /rest/wifiStatus | `IS_AUTHENTICATED` | none | Current status of the wifi client connection |
| GET | /rest/scanNetworks | `IS_ADMIN` | none | Async Scan for Networks in Range |
| GET | /rest/listNetworks | `IS_ADMIN` | none | List networks in range after successful scanning. Otherwise triggers scanning. |
| GET | /rest/wifiSettings | `IS_ADMIN` | none | Current WiFi settings |
| POST | /rest/wifiSettings | `IS_ADMIN` | `{"hostname":"esp32-f412fa4495f8","priority_RSSI":true,"wifi_networks":[{"ssid":"YourSSID","password":"YourPassword","static_ip_config":false}]}` | Update WiFi settings and credentials |
| GET | /rest/systemStatus | `IS_AUTHENTICATED` | none | Get system information about the ESP. |
| POST | /rest/restart | `IS_ADMIN` | none | Restart the ESP32 |
| POST | /rest/factoryReset | `IS_ADMIN` | none | Reset the ESP32 and all settings to their default values |
| POST | /rest/uploadFirmware | `IS_ADMIN` | none | File upload of firmware.bin |
| POST | /rest/sleep | `IS_AUTHENTICATED` | none | Puts the device in deep sleep mode |
| POST | /rest/downloadUpdate | `IS_ADMIN` | `{"download_url": "https://github.com/theelims/ESP32-sveltekit/releases/download/v0.1.0/firmware_esp32s3.bin"}` | Download link for OTA. This requires a valid SSL certificate and will follow redirects. |
## System
<!-- | HTTP Method | Endpoint | Description | Parameters |
|-------------|----------------|----------------------------|---------------------------|
| GET | /api/sensor/mpu | Retrieve the mpu state | |
| GET | /api/sensor/magnetometer | Retrieve the magnetometer state | |
| GET | /api/sensor/distances | Retrieve the distances state | |
| GET | /api/sensor/distance/{position} | Retrieve the distance state | `position`: The position of the distance sensor **LEFT** and **RIGHT** |
| GET | /api/sensor/stream | Retrieve the camera stream | |
| GET | /api/actuator | Retrieve the actuator states | |
| GET | /api/actuator/{id} | Retrieve the actuator state for `id` | `id`: The ID of the actuator |
| POST | /api/actuator/{id} | Set the actuator state | `id`: The ID of the actuator|
| GET | /api/kinematics/feet | Retrieve the current feet positions as (x, y, z) coordinates| |
| GET | /api/kinematics/body | Retrieve the current body position as a (x, y, z) coordinates| |
| GET | /api/kinematics/bodystate | Retrieve the current body and feet positions | |
| GET | /api/system/log | Retrieve the system log | |
| GET | /api/system/info | Retrieve the system information | |
| GET | /api/system/settings | Retrieve the system settings | |
| POST | /api/system/settings | Set the system settings | |
| POST | /api/system/reset | Reset system | |
| POST | /api/system/power/off | Power of the system | |
| POST | /api/system/stop | Stop power to actuators | `id`: The stop level **CUT**, **SETTLE_THEN_CUT**, **NONE** | -->
| Method | Endpoint | Description |
| ------ | ------------------- | -------------------------------------------- |
| GET | /api/features | Get enabled features for the UI |
| GET | /api/system/status | Get system information about the ESP |
| POST | /api/system/reset | Reset the ESP32 and all settings to defaults |
| POST | /api/system/restart | Restart the ESP32 |
| POST | /api/system/sleep | Put the device in deep sleep mode |
## WiFi
| Method | Endpoint | Description |
| ------ | ---------------------- | ------------------------------------- |
| GET | /api/wifi/sta/settings | Get current WiFi settings |
| POST | /api/wifi/sta/settings | Update WiFi settings and credentials |
| GET | /api/wifi/scan | Trigger async scan for networks |
| GET | /api/wifi/networks | List networks in range after scanning |
| GET | /api/wifi/sta/status | Get WiFi client connection status |
## Access Point
| Method | Endpoint | Description |
| ------ | ---------------- | --------------------- |
| GET | /api/ap/status | Get current AP status |
| GET | /api/ap/settings | Get AP settings |
| POST | /api/ap/settings | Update AP settings |
## Camera (if enabled)
| Method | Endpoint | Description |
| ------ | -------------------- | ---------------------- |
| GET | /api/camera/still | Capture a still image |
| GET | /api/camera/stream | Get camera stream |
| GET | /api/camera/settings | Get camera settings |
| POST | /api/camera/settings | Update camera settings |
## Servo
| Method | Endpoint | Description |
| ------ | ----------------- | ----------------------- |
| GET | /api/servo/config | Get servo configuration |
| POST | /api/servo/config | Update servo config |
## Peripherals
| Method | Endpoint | Description |
| ------ | ---------------- | -------------------------- |
| GET | /api/peripherals | Get peripheral settings |
| POST | /api/peripherals | Update peripheral settings |
## mDNS (if enabled)
| Method | Endpoint | Description |
| ------ | ---------------- | -------------------- |
| GET | /api/mdns | Get mDNS settings |
| POST | /api/mdns | Update mDNS settings |
| GET | /api/mdns/status | Get mDNS status |
| POST | /api/mdns/query | Query mDNS services |
## Filesystem
| Method | Endpoint | Description |
| ------ | ----------------- | ---------------- |
| GET | /api/config/\* | Get config file |
| GET | /api/files | List files |
| POST | /api/files | Upload file |
| POST | /api/files/delete | Delete file |
| POST | /api/files/edit | Edit file |
| POST | /api/files/mkdir | Create directory |