Report Status API
Devices can report update progress and status to the server.
Endpoint
POST /functions/v1/report-status
Authentication
X-API-Key: zk_live_xxxxxxxxxxxx
Request Body
{
"device_id": "device-001",
"firmware_id": "firmware-uuid",
"status": "completed",
"progress": 100,
"error_message": null
}
| Field | Type | Required | Description |
|-------|------|----------|-------------|
| device_id | string | Yes | Device identifier |
| firmware_id | string | Yes | Firmware ID from check-update response |
| status | string | Yes | Status code (see below) |
| progress | number | No | Progress percentage (0-100) |
| error_message | string | No | Error message if failed |
Status Codes
| Status | Description |
|--------|-------------|
| started | Update process started |
| downloading | Downloading firmware |
| verifying | Verifying hash and signature |
| applying | Writing to flash |
| rebooting | Rebooting to new firmware |
| completed | Update successful |
| failed | Update failed |
| rolled_back | Rolled back to previous version |
Response
{
"success": true,
"log_id": "update-log-uuid"
}
Example
cURL
curl -X POST \\
https://your-project.supabase.co/functions/v1/report-status \\
-H "Content-Type: application/json" \\
-H "X-API-Key: zk_live_xxxxxxxxxxxx" \\
-d '{
"device_id": "device-001",
"firmware_id": "abc123",
"status": "completed",
"progress": 100
}'
C (Embedded)
zelta_report_status(
update.firmware_id,
ZELTA_UPDATE_STATUS_COMPLETED,
NULL // no error
);
Best Practices
- Report progress: Send periodic updates during download
- Report failures: Always report failures with error message
- Report after reboot: Confirm successful boot on new firmware