REST API
Der Collab Server bietet eine REST API für Snapshots, Health-Checks und mehr.
Base URL
http://localhost:4000/apiEndpoints
Health Check
GET /healthResponse:
{
"status": "ok",
"uptime": 3600,
"version": "1.0.0"
}Snapshots
Snapshot erstellen
POST /api/snapshots
Content-Type: application/json
{
"artworkId": "item-001",
"sketch": "sketch-entities-001",
"image": "data:image/png;base64,...",
"parameters": { ... },
"metadata": {
"title": "Morning Light",
"description": "Warm color palette"
}
}Response:
{
"id": "snap_abc123",
"url": "/api/snapshots/snap_abc123",
"qrUrl": "/api/snapshots/snap_abc123/qr",
"created": "2024-06-15T10:30:00Z"
}Snapshot abrufen
GET /api/snapshots/:idResponse:
{
"id": "snap_abc123",
"artworkId": "item-001",
"sketch": "sketch-entities-001",
"image": "data:image/png;base64,...",
"parameters": { ... },
"metadata": {
"title": "Morning Light"
},
"created": "2024-06-15T10:30:00Z"
}Snapshot-Bild
GET /api/snapshots/:id/imageReturns: PNG image
QR-Code generieren
GET /api/snapshots/:id/qrQuery-Parameter:
| Parameter | Default | Beschreibung |
|---|---|---|
size |
200 |
Größe in Pixel |
format |
png |
png oder svg |
Returns: QR-Code Bild
Lifestream
Snapshots einer Ausstellung
GET /api/lifestream/:exhibitionQuery-Parameter:
| Parameter | Default | Beschreibung |
|---|---|---|
limit |
20 |
Max. Anzahl |
since |
- | Timestamp Filter |
Response:
{
"exhibition": "mosaik-2027",
"snapshots": [
{
"id": "snap_xyz",
"artworkId": "item-001",
"image": "/api/snapshots/snap_xyz/image",
"timestamp": "2024-06-15T10:30:00Z"
}
]
}Snapshot posten (vom Artwork)
POST /api/lifestream/:exhibition/snapshots
Content-Type: application/json
{
"artworkId": "item-001",
"image": "data:image/png;base64,..."
}Gallery
Artworks auflisten
GET /api/gallery/artworksResponse:
{
"items": [
{
"slug": "entities",
"name": "Entities",
"description": "Agent-basiertes System",
"thumbnail": "/assets/thumbs/entities.jpg"
}
]
}Artwork-Details
GET /api/gallery/artworks/:slugStatistics
GET /api/statsResponse:
{
"connections": {
"total": 42,
"artworks": 15,
"studio": 2
},
"snapshots": {
"total": 1234,
"today": 56
},
"uptime": 86400
}Error Handling
Fehler werden als JSON zurückgegeben:
{
"error": {
"code": "NOT_FOUND",
"message": "Snapshot not found",
"statusCode": 404
}
}Status-Codes
| Code | Bedeutung |
|---|---|
200 |
OK |
201 |
Created |
400 |
Bad Request |
404 |
Not Found |
500 |
Server Error |
Rate Limiting
| Endpoint | Limit |
|---|---|
/api/snapshots (POST) |
10/min |
/api/lifestream/*/snapshots |
1/min |
| Andere GET Endpoints | 100/min |
CORS
CORS ist für folgende Origins aktiviert:
http://localhost:*
https://*.quiet-frames.deAuthentication (optional)
Für geschützte Endpoints:
Authorization: Bearer <token>Token wird via Art.Works! Studio generiert.