MSECM Video Judge - REST API Dokumentation

Übersicht

Die MSECM Video Judge Anwendung enthält eine integrierte REST API, die externen Zugriff auf Aufnahmen, Marker und Protokolle ermöglicht.

API starten

  1. Öffnen Sie Settings > API Settings
  2. Konfigurieren Sie den API Port (Standard: 5080)
  3. Optional: Aktivieren Sie Auto-Start API
  4. Klicken Sie Start API

Basis-URL

http://localhost:5080/api

OpenAPI-Dokumentation

Die automatisch generierte OpenAPI-Spezifikation ist verfügbar unter:

http://localhost:5080/openapi/v1.json

Snapshots API

Verwaltet Videoaufnahmen (Snapshots).

Alle Snapshots abrufen

GET /api/snapshots

Antwort:

[
  {
    "id": 1,
    "timeStamp": "2026-03-15T14:30:00",
    "event": "S",
    "eventNr": 5,
    "heatNr": 2,
    "laneNr": null,
    "lapNr": null,
    "filePath": "C:\\Videos\\Ev05_Heat02_S_2026-03-15_14-30-00.avi",
    "preBufferDuration": "00:00:10",
    "postCaptureDuration": "00:00:10",
    "createdAt": "2026-03-15T14:30:20",
    "totalFrames": 600
  }
]

Snapshot nach ID abrufen

GET /api/snapshots/{id}
Parameter Typ Beschreibung
id int Snapshot-ID

Snapshot-Video streamen

GET /api/snapshots/{id}/stream

Unterstützt HTTP Range Requests für Seeking.

Request Headers (optional):

Range: bytes=0-1048575

Response:

Video-Informationen abrufen

GET /api/snapshots/{id}/info

Antwort:

{
  "snapshotId": 1,
  "fileName": "Ev05_Heat02_S_2026-03-15_14-30-00.avi",
  "fileSize": 52428800,
  "contentType": "video/x-msvideo",
  "totalFrames": 600,
  "preBufferDuration": "00:00:10",
  "postCaptureDuration": "00:00:10",
  "event": "S",
  "eventNr": 5,
  "heatNr": 2,
  "laneNr": null,
  "lapNr": null,
  "timeStamp": "2026-03-15T14:30:00",
  "streamUrl": "/api/snapshots/1/stream"
}

Snapshot-Liste (kompakt)

GET /api/snapshots/list

Gibt eine kompakte Liste aller Snapshots mit Stream-URLs zurück.

Nach Event-Typ filtern

GET /api/snapshots/event/{eventType}
Parameter Typ Werte
eventType char S=Start, I=Intermediate, A=Finish, D=Reaction

Nach Event-Nummer filtern

GET /api/snapshots/eventnr/{eventNr}

Nach Heat filtern

GET /api/snapshots/heat/{eventNr}/{heatNr}

Nach Lane filtern

GET /api/snapshots/lane/{eventNr}/{heatNr}/{laneNr}

Nach Zeitraum filtern

GET /api/snapshots/range?from={from}&to={to}
Parameter Typ Format
from DateTime ISO 8601 (z.B. 2026-03-15T00:00:00)
to DateTime ISO 8601 (z.B. 2026-03-15T23:59:59)

Neueste Snapshots

GET /api/snapshots/recent/{count}
Parameter Typ Standard
count int 100

Anzahl Snapshots

GET /api/snapshots/count

Antwort:

42

Markers API

Verwaltet Marker (Markierungen in Videos).

Alle Marker abrufen

GET /api/markers

Antwort:

[
  {
    "id": 1,
    "snapShotDataId": 1,
    "frameNumber": 150,
    "createdAt": "2026-03-15T14:35:00",
    "name": "Wandberührung",
    "note": "Schwimmer berührte bei Frame 150"
  }
]

Marker nach ID abrufen

GET /api/markers/{id}

Marker eines Snapshots

GET /api/markers/snapshot/{snapShotId}

Marker suchen

GET /api/markers/search?name={name}
Parameter Typ Beschreibung
name string Suchbegriff für Marker-Name

Nach Zeitraum filtern

GET /api/markers/range?from={from}&to={to}

Neueste Marker

GET /api/markers/recent/{count}

Anzahl Marker

GET /api/markers/count

Anzahl Marker pro Snapshot

GET /api/markers/count/snapshot/{snapShotId}

Marker erstellen

POST /api/markers
Content-Type: application/json

Request Body:

{
  "snapShotDataId": 1,
  "frameNumber": 150,
  "name": "Wandberührung",
  "note": "Optionale Notiz"
}

Antwort: 201 Created

{
  "id": 2,
  "snapShotDataId": 1,
  "frameNumber": 150,
  "createdAt": "2026-03-15T14:40:00",
  "name": "Wandberührung",
  "note": "Optionale Notiz"
}

Marker aktualisieren

PUT /api/markers/{id}
Content-Type: application/json

Request Body:

{
  "frameNumber": 155,
  "name": "Wandberührung (korrigiert)",
  "note": "Aktualisierte Notiz"
}

Marker löschen

DELETE /api/markers/{id}

Antwort: 204 No Content


Logs API

Zugriff auf Anwendungsprotokolle.

Alle Logs abrufen

GET /api/logs

Antwort:

[
  {
    "id": 1,
    "timestamp": "2026-03-15T14:30:00",
    "type": "General",
    "message": "Application started"
  }
]

Log nach ID abrufen

GET /api/logs/{id}

Nach Typ filtern

GET /api/logs/type/{type}
Typ Beschreibung
Serial Serielle Verbindungsereignisse
SerialMessage Empfangene Timing-Nachrichten
CAM Kameraoperationen
General Allgemeine Ereignisse
Error Fehlermeldungen
DB Datenbankoperationen

Nach Zeitraum filtern

GET /api/logs/range?from={from}&to={to}

Neueste Logs

GET /api/logs/recent/{count}

Anzahl Logs

GET /api/logs/count

Fehlerantworten

404 Not Found

{
  "error": "Snapshot not found"
}

400 Bad Request

{
  "error": "Invalid request parameters"
}

500 Internal Server Error

{
  "error": "Internal server error"
}

Beispiele

cURL

Snapshots auflisten:

curl http://localhost:5080/api/snapshots

Video herunterladen:

curl -o video.avi http://localhost:5080/api/snapshots/1/stream

Marker erstellen:

curl -X POST http://localhost:5080/api/markers \
  -H "Content-Type: application/json" \
  -d '{"snapShotDataId":1,"frameNumber":150,"name":"Zielankunft"}'

JavaScript

// Snapshots abrufen
const response = await fetch('http://localhost:5080/api/snapshots');
const snapshots = await response.json();

// Video im HTML5-Player abspielen
const video = document.getElementById('player');
video.src = 'http://localhost:5080/api/snapshots/1/stream';
video.play();

// Marker erstellen
await fetch('http://localhost:5080/api/markers', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    snapShotDataId: 1,
    frameNumber: 150,
    name: 'Wandberührung'
  })
});

C# / .NET

using var client = new HttpClient();
client.BaseAddress = new Uri("http://localhost:5080");

// Snapshots abrufen
var snapshots = await client.GetFromJsonAsync<List<SnapShotData>>("api/snapshots");

// Marker erstellen
var marker = new CreateMarkerDto
{
    SnapShotDataId = 1,
    FrameNumber = 150,
    Name = "Wandberührung"
};
await client.PostAsJsonAsync("api/markers", marker);

Netzwerkzugriff

Firewall konfigurieren

Um die API im Netzwerk verfügbar zu machen:

  1. Öffnen Sie Windows Defender Firewall
  2. Erstellen Sie eine eingehende Regel für den API-Port (Standard: 5080)
  3. Erlauben Sie TCP-Verbindungen

Von anderen Geräten zugreifen

Verwenden Sie die IP-Adresse des Computers anstelle von localhost:

http://192.168.1.100:5080/api/snapshots

IP-Adresse ermitteln:

ipconfig

Sicherheitshinweise