81 lines
1.5 KiB
Markdown
81 lines
1.5 KiB
Markdown
ID: DOC_000006 | Version: 0.2.3 | Status: Draft
|
||
Archived – superseded by new documentation.
|
||
By: Codex (GPT-5)
|
||
|
||
# Update API (Kiddo Backend)
|
||
|
||
## Purpose
|
||
Definiert interne API-Endpunkte fuer Update-Status, Check, Apply, Rollback und Logs.
|
||
|
||
## Endpoints
|
||
|
||
### POST /update/enroll
|
||
Body (optional):
|
||
```json
|
||
{ "enroll_token": "<one-time-token>" }
|
||
```
|
||
Antwort:
|
||
```json
|
||
{ "enrolled": true, "message": "Enrollment successful" }
|
||
```
|
||
|
||
### GET /update/status
|
||
Antwort:
|
||
```json
|
||
{
|
||
"current_version": "0.1.2",
|
||
"last_status": "success|failed|unknown",
|
||
"last_error": "<optional>",
|
||
"last_timestamp": "2025-12-28T12:34:56Z",
|
||
"enrolled": true
|
||
}
|
||
```
|
||
|
||
### POST /update/check
|
||
Antwort:
|
||
```json
|
||
{
|
||
"available": true,
|
||
"latest_version": "0.1.3",
|
||
"artifact_url": "https://update.wlkns.org/kiddo/kiddo-0.1.3.tar.gz",
|
||
"sha256": "<hex>",
|
||
"message": "<optional>"
|
||
}
|
||
```
|
||
|
||
### POST /update/apply
|
||
Body (optional):
|
||
```json
|
||
{ "version": "0.1.3" }
|
||
```
|
||
Antwort:
|
||
```json
|
||
{ "started": true, "message": "update started" }
|
||
```
|
||
|
||
### POST /update/rollback
|
||
Antwort:
|
||
```json
|
||
{ "started": true, "message": "rollback started" }
|
||
```
|
||
|
||
### GET /update/logs
|
||
Antwort:
|
||
```json
|
||
[
|
||
{
|
||
"timestamp": "2025-12-28T12:34:56Z",
|
||
"status": "success",
|
||
"message": "updated to 0.1.2",
|
||
"version": "0.1.2",
|
||
"device_id": "kiddo-001",
|
||
"error": null
|
||
}
|
||
]
|
||
```
|
||
|
||
## Notes
|
||
- Alle Endpunkte erfordern Auth (Session-Cookie oder `Authorization: Bearer <token>`).
|
||
- Apply/Rollback starten async; UI pollt /update/status.
|
||
- `/update/enroll` speichert das Update-Token lokal (siehe `SKD_UPDATE_TOKEN_FILE`).
|