Dokumentation » API » Config API
Config API
Erstellt: 2025-12-27 | Aktualisiert: 2025-12-31
REST-API für Config-Management. Ermöglicht das Abrufen und Aktualisieren von System-Konfigurationen wie Prompts, Strukturen und Autorenprofile.
| Controller | Controller\Api\ConfigController |
| Base-URL | /api/v1/config |
| Datenbank | ki_content.content_config |
| UseCase | UseCases\Config\ManageConfigUseCase |
Endpoints-Übersicht
| Methode | Pfad | Beschreibung |
| GET | /api/v1/config/{id} | Config abrufen |
| POST | /api/v1/config/{id} | Config aktualisieren |
Config abrufen
GET /api/v1/config/{id}
Response
{
"id": 1,
"name": "System Prompt",
"type": "system_prompt",
"content": "Du bist ein hilfreicher Assistent...",
"version": "1.5"
}
Response-Felder
| Feld | Typ | Beschreibung |
| id | int | Config-ID |
| name | string | Config-Name |
| type | string | Config-Typ (siehe unten) |
| content | string | Config-Inhalt |
| version | string | Aktuelle Version |
Fehler-Response (404)
{
"error": "Config nicht gefunden"
}
Config aktualisieren
POST /api/v1/config/{id}
Content-Type: application/x-www-form-urlencoded
X-CSRF-TOKEN: {token}
content=Neuer+Config-Inhalt...
Request-Parameter
| Parameter | Typ | Beschreibung |
| content | string | Neuer Config-Inhalt |
Hinweis: Die Version wird automatisch inkrementiert (1.5 → 1.6).
Response
{
"success": true,
"version": "1.6",
"message": "Version 1.6 gespeichert"
}
Fehler-Response (400)
{
"error": "Validierungsfehler..."
}
Authentifizierung
Das POST-Endpoint erfordert einen gültigen CSRF-Token im Header:
X-CSRF-TOKEN: abc123...
Config-Typen
| Typ | Beschreibung | Beispiel |
| author_profile | Autorenprofile für Schreibstil | Karl Kratz Stil, Akademisch |
| structure | Output-Strukturen | LinkedIn-Post, Blog-Artikel |
| organization | Organisations-Infos | Firmenkontext |
| contract | Content-Verträge | Qualitätsregeln |
| rule | Einzelne Regeln | Formatvorgaben |
| system_prompt | System-Prompts für Chat | RAG-Prompt, Coaching-Prompt |
| critic | Kritik-Prompts | Qualitätsprüfer |
Versionierung
Jede Änderung erstellt eine neue Version:
- Version wird automatisch inkrementiert (Minor-Version)
- Format:
MAJOR.MINOR (z.B. 1.5 → 1.6)
- Historie wird in
content_config_history gespeichert
Fehlerbehandlung
| HTTP Code | Bedeutung |
| 400 | Validierungsfehler |
| 403 | CSRF-Token ungültig |
| 404 | Config nicht gefunden |
| 500 | Server-Fehler |
Datenmodell
content_config (ki_content)
| Feld | Typ | Null | Beschreibung |
| id | int(11) | NO | Primärschlüssel |
| type | enum | NO | author_profile, structure, organization, contract, rule, system_prompt, critic |
| name | varchar(100) | NO | Config-Name |
| slug | varchar(100) | NO | URL-Slug |
| description | text | YES | Beschreibung |
| content | longtext | NO | Config-Inhalt |
| version | varchar(20) | YES | Aktuelle Version (Default: 1.0) |
| status | enum | YES | draft, active, deprecated (Default: draft) |
| parent_id | int(11) | YES | Parent-Config (optional) |
| prompt_id | int(11) | YES | Verknüpfter Prompt |
| sort_order | int(11) | NO | Sortierung (Default: 0) |
| created_at | datetime | YES | Erstellungsdatum |
| updated_at | datetime | YES | Letzte Änderung |
Verwandte Dokumentation
]]>