API-Referenz
Cuby bietet eine REST-API für die programmgesteuerte Steuerung. Der Server läuft standardmäßig auf Port 3847.
Base URL
http://localhost:3847/apiHealth
| Method | Endpoint | Beschreibung |
|---|---|---|
| GET | /api/health | Health Check — gibt {status: "ok", timestamp} zurück |
Konfiguration
| Method | Endpoint | Beschreibung |
|---|---|---|
| GET | /api/config | Aktuelle Konfiguration inkl. installierter Produkte, API-Key-Status, Operator-Modus und Version |
| POST | /api/config/apikey | API Key speichern (UUID v4 Format erforderlich) |
| GET | /api/config/autostart | Autostart-Status abfragen |
| POST | /api/config/autostart | Autostart aktivieren/deaktivieren ({enabled: true/false}) |
| POST | /api/config/trial | Trial-Lizenz erstellen (generiert UUID, registriert beim Marketplace) |
| GET | /api/config/validate-apikey | API Key gegen Marketplace validieren |
Marketplace
| Method | Endpoint | Beschreibung |
|---|---|---|
| GET | /api/marketplace/products | Alle verfügbaren Produkte mit Installationsstatus und Update-Info |
| GET | /api/marketplace/courses | Kurse aus dem Marketplace |
| GET | /api/marketplace/videos | Aktuelle Videos |
Installation
| Method | Endpoint | Beschreibung |
|---|---|---|
| POST | /api/install | Installation starten — Body: {products: [{productId, alias?}]} |
| POST | /api/install/cancel | Ausstehende Installation abbrechen — Body: {instanceId} |
| GET | /api/install/status?productId=X | Installationsfortschritt abfragen |
Installations-Status
| Status | Beschreibung |
|---|---|
installing | Installation läuft |
needs_config | Wartet auf Benutzerkonfiguration |
installed | Erfolgreich installiert |
failed | Installation fehlgeschlagen |
updating | Update läuft |
Produkte
| Method | Endpoint | Beschreibung |
|---|---|---|
| GET | /api/products/status | Status aller laufenden Prozesse |
| GET | /api/products/health | Health-Check aller Produkte |
| POST | /api/products/start-all | Alle konfigurierten Plugins starten |
| GET | /api/products/:id/status | Status eines Produkts |
| GET | /api/products/:id/health | Health-Check eines Produkts |
| POST | /api/products/:id/start | Produkt starten |
| POST | /api/products/:id/stop | Produkt stoppen |
| POST | /api/products/:id/restart | Produkt neustarten |
| GET | /api/products/:id/logs?limit=100 | In-Memory-Logs (Standard: 100 Zeilen) |
| GET | /api/products/:id/logfile?lines=500 | Log-Datei (Standard: 500 Zeilen) |
| POST | /api/products/:id/update | Auf neueste Version aktualisieren |
| DELETE | /api/products/:id/uninstall | Produkt deinstallieren |
| GET | /api/products/:id/has-config | Prüfen ob Konfigurationsdialog vorhanden |
| GET | /api/products/:id/config | Aktuelle Plugin-Konfiguration |
| POST | /api/products/:id/configure | Konfiguration speichern und Deployment starten |
| GET | /api/products/:id/config-component.js | React-Konfigurationskomponente |
| GET | /api/products/:id/has-detail | Prüfen ob Detail-Komponente vorhanden |
| GET | /api/products/:id/detail-component.js | React-Detail-Komponente |
Plugin-Routes
| Method | Endpoint | Beschreibung |
|---|---|---|
| GET/POST/PUT/DELETE | /api/plugins/:instanceId/* | Weiterleitung an Plugin-registrierte Routes |
ProcessCubes
| Method | Endpoint | Beschreibung |
|---|---|---|
| GET | /api/processcubes | Alle registrierten ProcessCube®-Instanzen |
Setup
| Method | Endpoint | Beschreibung |
|---|---|---|
| POST | /api/setup/complete | Setup als abgeschlossen markieren |
Echtzeit-Events (Socket.IO)
Cuby nutzt Socket.IO für Echtzeit-Kommunikation mit dem Frontend. Verbinden Sie sich mit dem Socket.IO-Server auf dem gleichen Port wie die REST-API.
| Event | Richtung | Beschreibung |
|---|---|---|
install:status | Server → Client | Installationsfortschritt pro Produkt |
products:status | Server → Client | Status-Änderungen aller Produkte |
product:log | Server → Client | Einzelne Log-Zeilen eines Produkts |
system:status | Server → Client | System-Setup-Fortschritt |
subscribe:logs | Client → Server | Log-Stream für ein Produkt abonnieren |
unsubscribe:logs | Client → Server | Log-Stream abbestellen |
Beispiel
import { io } from "socket.io-client";
const socket = io("http://localhost:3847");
// Status-Updates empfangen
socket.on("products:status", (data) => {
console.log("Status update:", data);
});
// Log-Stream abonnieren
socket.emit("subscribe:logs", { instanceId: "processcube-engine" });
socket.on("product:log", (data) => {
console.log("Log:", data);
});
// Log-Stream abbestellen
socket.emit("unsubscribe:logs", { instanceId: "processcube-engine" });