API-Referenz
REST-API für das KI-Task-Management System.
| Base-URL | /api/v1/tasks |
|---|---|
| Format | JSON |
| Authentifizierung | Keine (lokales Netzwerk) |
Endpoints
Tasks
| Methode | Endpoint | Beschreibung |
|---|---|---|
| GET | /api/v1/tasks | Liste aller Tasks |
| GET | /api/v1/tasks/{id} | Task-Details |
| POST | /api/v1/tasks | Task erstellen |
| PUT | /api/v1/tasks/{id} | Task aktualisieren |
| DELETE | /api/v1/tasks/{id} | Task löschen |
| GET | /api/v1/tasks/statistics | Statistiken |
Zuweisungen & Ergebnisse
| Methode | Endpoint | Beschreibung |
|---|---|---|
| POST | /api/v1/tasks/{id}/assign | Task zuweisen |
| PUT | /api/v1/tasks/{id}/status | Status ändern |
| GET | /api/v1/tasks/{id}/results | Ergebnisse abrufen |
| POST | /api/v1/tasks/{id}/results | Ergebnis speichern |
| POST | /api/v1/tasks/{id}/execute | KI-Ausführung |
GET /api/v1/tasks
Listet alle Tasks mit optionalen Filtern.
Query-Parameter
| Parameter | Typ | Beschreibung |
|---|---|---|
| status | string | pending, in_progress, completed, failed, cancelled |
| type | string | human_task, ai_task, mixed |
| priority | string | low, medium, high, critical |
| search | string | Suche in Titel/Beschreibung |
| limit | int | Max. Anzahl (default: 50) |
| offset | int | Offset für Paginierung |
Beispiel
curl "http://localhost/api/v1/tasks?status=pending&limit=10"
Response
{
"success": true,
"data": [
{
"id": 1,
"uuid": "abc-123-...",
"title": "Analyse durchführen",
"type": "ai_task",
"priority": "high",
"status": "pending",
"created_by": "root",
"created_at": "2025-12-20 10:00:00"
}
],
"meta": {
"total": 42,
"limit": 10,
"offset": 0
}
}
POST /api/v1/tasks
Erstellt einen neuen Task.
Request-Body
{
"title": "Analyse durchführen", // required
"description": "Details...", // optional
"type": "ai_task", // optional: human_task, ai_task, mixed
"priority": "high", // optional: low, medium, high, critical
"created_by": "user", // optional
"created_by_type": "human", // optional: human, ai
"due_date": "2025-12-31 23:59:59", // optional
"parent_task_id": 1, // optional
"metadata": {"key": "value"} // optional
}
Beispiel
curl -X POST http://localhost/api/v1/tasks \
-H "Content-Type: application/json" \
-d '{
"title": "Daten analysieren",
"type": "ai_task",
"priority": "high"
}'
Response (201 Created)
{
"success": true,
"data": {
"id": 2,
"uuid": "def-456-...",
"title": "Daten analysieren",
"status": "pending",
...
}
}
GET /api/v1/tasks/{id}
Gibt Task-Details inkl. Zuweisungen, Ergebnisse und Subtasks zurück.
Response
{
"success": true,
"data": {
"task": { ... },
"assignments": [ ... ],
"results": [ ... ],
"subtasks": [ ... ]
}
}
POST /api/v1/tasks/{id}/assign
Weist einen Task einem Bearbeiter zu.
Request-Body
{
"assignee": "ollama", // required
"assignee_type": "ollama", // required: human, ollama, claude, anthropic_api
"model_name": "mistral", // optional
"assigned_by": "user", // optional
"notes": "Bitte priorisieren" // optional
}
PUT /api/v1/tasks/{id}/status
Ändert den Task-Status.
Request-Body
{
"status": "in_progress", // required
"updated_by": "user", // optional
"updated_by_type": "human" // optional
}
Erlaubte Übergänge
| Von | Nach |
|---|---|
| pending | in_progress, cancelled |
| in_progress | completed, failed, cancelled |
| completed/failed/cancelled | (keine) |
POST /api/v1/tasks/{id}/execute
Führt einen Task mit KI aus.
Request-Body
{
"executor_type": "ollama", // optional: ollama, anthropic_api
"model": "mistral", // optional
"auto_complete": true, // optional: Task nach Erfolg abschließen
"additional_context": "..." // optional: Zusätzlicher Kontext
}
Response
{
"success": true,
"data": {
"id": 1,
"task_id": 2,
"executor": "ollama",
"model_name": "mistral",
"response": "Die Analyse ergab...",
"tokens_input": 150,
"tokens_output": 420,
"tokens_total": 570,
"duration_ms": 12500,
"status": "success"
}
}
Error-Responses
// 400 Bad Request
{
"success": false,
"error": "Title is required"
}
// 404 Not Found
{
"success": false,
"error": "Task not found"
}
// 500 Internal Server Error
{
"success": false,
"error": "Database connection failed"
}