-
Notifications
You must be signed in to change notification settings - Fork 0
REST API Reference
Complete API documentation for the Smart Sit-Stand Desk Controller. All endpoints support CORS for cross-origin requests.
http://<pico-ip-address>/
Replace <pico-ip-address>
with your Pico W's IP address on your network.
GET /get_height
Description: Returns the current desk height in real-world units.
Response:
{"height": "95.5"}
GET /get_minmax
Description: Returns the configured minimum and maximum height limits.
Response:
{"min": 72.0, "max": 120.0}
GET /get_presets
Description: Returns all configured preset heights.
Response:
["1: 95.5", "2: 110.0", "3: 115.2"]
GET /islocked
Description: Returns whether the desk is currently locked.
Response:
{"locked": false}
GET /forward
Description: Starts moving the desk upward.
Response:
{"status": "ok"}
Note: Returns {"status": "nok"}
if desk is locked.
GET /backward
Description: Starts moving the desk downward.
Response:
{"status": "ok"}
Note: Returns {"status": "nok"}
if desk is locked.
GET /stop
Description: Immediately stops any desk movement.
Response:
{"status": "ok"}
GET /go?height=100.5
Parameters:
-
height
(required): Target height in real-world units (float)
Description: Moves desk to the specified height.
Response:
{"status": "ok"}
GET /go_preset?preset=1
Parameters:
-
preset
(required): Preset number (1, 2, or 3)
Description: Moves desk to the specified preset position.
Response:
{"status": "ok"}
Note: Returns {"status": "nok"}
if preset doesn't exist.
GET /lock
Description: Locks the desk to prevent all movement.
Response:
{"status": "ok"}
GET /unlock
Description: Unlocks the desk to allow movement.
Response:
{"status": "ok"}
GET /set_min?min=70.0
Parameters:
-
min
(required): New minimum height limit (float)
Description: Updates the minimum height limit.
Response:
{"status": "ok"}
GET /set_max?max=125.0
Parameters:
-
max
(required): New maximum height limit (float)
Description: Updates the maximum height limit.
Response:
{"status": "ok"}
All API endpoints return JSON responses with consistent formatting.
{
"status": "ok",
"data": "response_data"
}
{
"status": "nok",
"error": "Description of error"
}
All responses include CORS headers:
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: *
// Get current height
const response = await fetch('http://192.168.1.100/get_height');
const data = await response.json();
console.log('Current height:', data.height);
// Move to specific height
await fetch('http://192.168.1.100/go?height=110.0');
// Go to preset 1
await fetch('http://192.168.1.100/go_preset?preset=1');
import requests
# Get current height
response = requests.get('http://192.168.1.100/get_height')
height = response.json()['height']
print(f'Current height: {height}')
# Move desk up
requests.get('http://192.168.1.100/forward')
# Stop movement after delay
time.sleep(2)
requests.get('http://192.168.1.100/stop')
# Get current height
curl http://192.168.1.100/get_height
# Move to sitting height
curl "http://192.168.1.100/go?height=95.0"
# Lock desk
curl http://192.168.1.100/lock
# Check if locked
curl http://192.168.1.100/islocked
The /lock
endpoint provides a software lock that prevents all movement commands. When locked:
- Movement endpoints (
/forward
,/backward
,/go
,/go_preset
) return{"status": "nok"}
- Configuration changes are still allowed
- The lock persists across system restarts
- API is accessible to all devices on the local network
- No authentication required (designed for home/office use)
- Consider network-level security (VPN, firewall rules) for enhanced protection
- Always verify desk response before issuing multiple commands
- Use
/stop
endpoint for emergency stops - Physical buttons override API commands
- Height limits are enforced in software
- No built-in rate limiting
- Avoid rapid successive calls to prevent system overload
- Allow movement commands to complete before issuing new ones
- Always check response status (
"ok"
vs"nok"
) - Handle network timeouts gracefully
- Implement retry logic for critical operations
π Support: For API issues or feature requests, use GitHub Issues