docs: update
This commit is contained in:
60
docs/API.md
60
docs/API.md
@@ -15,12 +15,18 @@ The SPORE system provides a comprehensive RESTful API for monitoring and control
|
||||
|
||||
| Endpoint | Method | Description | Response |
|
||||
|----------|--------|-------------|----------|
|
||||
| `/api/node/status` | GET | System resource information and API endpoint registry | System metrics and API catalog |
|
||||
| `/api/node/status` | GET | System resource information | System metrics |
|
||||
| `/api/node/endpoints` | GET | API endpoints and parameters | Detailed endpoint specifications |
|
||||
| `/api/cluster/members` | GET | Cluster membership and node health information | Cluster topology and health status |
|
||||
| `/api/node/update` | POST | Handle firmware updates via OTA | Update progress and status |
|
||||
| `/api/node/restart` | POST | Trigger system restart | Restart confirmation |
|
||||
|
||||
### Monitoring API
|
||||
|
||||
| Endpoint | Method | Description | Response |
|
||||
|----------|--------|-------------|----------|
|
||||
| `/api/monitoring/resources` | GET | CPU, memory, filesystem, and uptime | System resource metrics |
|
||||
|
||||
### Network Management API
|
||||
|
||||
| Endpoint | Method | Description | Response |
|
||||
@@ -140,7 +146,7 @@ Controls the execution state of individual tasks. Supports enabling, disabling,
|
||||
|
||||
#### GET /api/node/status
|
||||
|
||||
Returns comprehensive system resource information including memory usage, chip details, and a registry of all available API endpoints.
|
||||
Returns comprehensive system resource information including memory usage and chip details. For a list of available API endpoints, use `/api/node/endpoints`.
|
||||
|
||||
**Response Fields:**
|
||||
- `freeHeap`: Available RAM in bytes
|
||||
@@ -168,7 +174,7 @@ Returns comprehensive system resource information including memory usage, chip d
|
||||
|
||||
#### GET /api/node/endpoints
|
||||
|
||||
Returns detailed information about all available API endpoints, including their parameters, types, and validation rules.
|
||||
Returns detailed information about all available API endpoints, including their parameters, types, and validation rules. Methods are returned as strings (e.g., "GET", "POST").
|
||||
|
||||
**Response Fields:**
|
||||
- `endpoints[]`: Array of endpoint capability objects
|
||||
@@ -236,6 +242,54 @@ Initiates an over-the-air firmware update. The firmware file should be uploaded
|
||||
|
||||
Triggers a system restart. The response will be sent before the restart occurs.
|
||||
|
||||
### Monitoring
|
||||
|
||||
#### GET /api/monitoring/resources
|
||||
|
||||
Returns real-time system resource metrics.
|
||||
|
||||
Response Fields:
|
||||
- `cpu.current_usage`: Current CPU usage percent
|
||||
- `cpu.average_usage`: Average CPU usage percent
|
||||
- `cpu.max_usage`: Max observed CPU usage
|
||||
- `cpu.min_usage`: Min observed CPU usage
|
||||
- `cpu.measurement_count`: Number of measurements
|
||||
- `cpu.is_measuring`: Whether measurement is active
|
||||
- `memory.free_heap`: Free heap bytes
|
||||
- `memory.total_heap`: Total heap bytes (approximate)
|
||||
- `memory.heap_fragmentation`: Fragmentation percent (0 on ESP8266)
|
||||
- `filesystem.total_bytes`: LittleFS total bytes
|
||||
- `filesystem.used_bytes`: Used bytes
|
||||
- `filesystem.free_bytes`: Free bytes
|
||||
- `filesystem.usage_percent`: Usage percent
|
||||
- `system.uptime_ms`: Uptime in milliseconds
|
||||
Example Response:
|
||||
```json
|
||||
{
|
||||
"cpu": {
|
||||
"current_usage": 3.5,
|
||||
"average_usage": 2.1,
|
||||
"max_usage": 15.2,
|
||||
"min_usage": 0.0,
|
||||
"measurement_count": 120,
|
||||
"is_measuring": true
|
||||
},
|
||||
"memory": {
|
||||
"free_heap": 48748,
|
||||
"total_heap": 81920,
|
||||
"heap_fragmentation": 0
|
||||
},
|
||||
"filesystem": {
|
||||
"total_bytes": 65536,
|
||||
"used_bytes": 10240,
|
||||
"free_bytes": 55296,
|
||||
"usage_percent": 15.6
|
||||
},
|
||||
"system": {
|
||||
"uptime_ms": 123456
|
||||
}
|
||||
}
|
||||
```
|
||||
### Network Management
|
||||
|
||||
#### GET /api/network/status
|
||||
|
||||
Reference in New Issue
Block a user