API Reference
API Reference
Section titled “API Reference”DevAll exposes REST endpoints and WebSocket communication for service control.
REST API
Section titled “REST API”Base URL: http://localhost:7777/api
Service Control
Section titled “Service Control”GET /api/services
Section titled “GET /api/services”Get all services and their status.
curl http://localhost:7777/api/servicesResponse:
{ "services": [ { "id": "api", "name": "API Server", "status": "running", "port": 3000, "pid": 12345 } ]}POST /api/services/:id/start
Section titled “POST /api/services/:id/start”Start a service.
curl -X POST http://localhost:7777/api/services/api/startPOST /api/services/:id/stop
Section titled “POST /api/services/:id/stop”Stop a service.
curl -X POST http://localhost:7777/api/services/api/stopPOST /api/services/:id/restart
Section titled “POST /api/services/:id/restart”Restart a service.
curl -X POST http://localhost:7777/api/services/api/restartDELETE /api/services/:id/logs
Section titled “DELETE /api/services/:id/logs”Clear service logs.
curl -X DELETE http://localhost:7777/api/services/api/logsConfiguration
Section titled “Configuration”GET /api/config
Section titled “GET /api/config”Get current configuration.
curl http://localhost:7777/api/configPUT /api/services/:id
Section titled “PUT /api/services/:id”Update service configuration.
curl -X PUT http://localhost:7777/api/services/api \ -H "Content-Type: application/json" \ -d '{"port": 3001, "autostart": true}'System
Section titled “System”GET /api/health
Section titled “GET /api/health”Health check endpoint.
curl http://localhost:7777/api/healthResponse:
{ "status": "ok", "uptime": 3600, "services": 5}GET /api/resources
Section titled “GET /api/resources”Get system resource usage.
curl http://localhost:7777/api/resourcesResponse:
{ "cpu": { "usage": 45.2, "cores": 8 }, "memory": { "used": 4294967296, "total": 17179869184, "percentage": 25 }}WebSocket Protocol
Section titled “WebSocket Protocol”Connect to: ws://localhost:7777/ws
Client → Server Messages
Section titled “Client → Server Messages”Terminal Input
Section titled “Terminal Input”Send input to terminal services:
{ "type": "terminal-input", "serviceId": "terminal-1", "data": "ls -la\n"}Command Execution
Section titled “Command Execution”Execute commands:
{ "type": "command", "action": "start", "serviceId": "api"}Server → Client Messages
Section titled “Server → Client Messages”Initial State
Section titled “Initial State”Sent immediately after connection:
{ "type": "init", "services": [...], "logs": {...}}Status Update
Section titled “Status Update”Service status changes:
{ "type": "status", "serviceId": "api", "status": "running", "pid": 12345}Log Output
Section titled “Log Output”Service output:
{ "type": "log", "serviceId": "api", "level": "info", "message": "Server started on port 3000", "timestamp": "2024-01-20T10:30:00Z"}Resource Update
Section titled “Resource Update”System metrics:
{ "type": "resource-update", "cpu": 45.2, "memory": 4294967296, "services": { "api": { "cpu": 12.5, "memory": 536870912 } }}Configuration Update
Section titled “Configuration Update”Config changes:
{ "type": "config-update", "serviceId": "api", "config": { "port": 3001, "autostart": true }}Error Codes
Section titled “Error Codes”| Code | Description |
|---|---|
| 200 | Success |
| 400 | Bad request |
| 404 | Service not found |
| 409 | Service already running |
| 500 | Internal server error |
Rate Limiting
Section titled “Rate Limiting”- No rate limiting on REST endpoints
- WebSocket messages are throttled to 100/second per client
- Log batching occurs at 16ms intervals
Authentication
Section titled “Authentication”Currently no authentication required. DevAll is designed for local development only.
Security Note: Do not expose DevAll ports to the internet. Use tunneling services (ngrok) for secure external access.
Client Libraries
Section titled “Client Libraries”JavaScript/TypeScript
Section titled “JavaScript/TypeScript”// WebSocket connectionconst ws = new WebSocket('ws://localhost:7777/ws');
ws.onmessage = (event) => { const data = JSON.parse(event.data); console.log('Received:', data);};
// REST APIfetch('http://localhost:7777/api/services') .then(res => res.json()) .then(data => console.log(data));Python
Section titled “Python”import websocketimport requests
# REST APIresponse = requests.get('http://localhost:7777/api/services')print(response.json())
# WebSocketdef on_message(ws, message): print(f"Received: {message}")
ws = websocket.WebSocketApp("ws://localhost:7777/ws", on_message=on_message)ws.run_forever()CLI Usage
Section titled “CLI Usage”# Using curlcurl http://localhost:7777/api/services | jq
# Using websocat for WebSocketwebsocat ws://localhost:7777/ws