Skip to content

API Architecture & Route Conventions ​

The RUSEON Core API subsystem is built on a high-throughput Gin HTTP framework and a concurrent gRPC server engine (internal/api/router.go).


1. Route Namespace Architecture ​

RUSEON Core organizes HTTP endpoints into clear functional namespaces:

Namespace PatternAuthenticationPurpose
/api/*JWT Bearer / Public (/api/login)Camera provisioning, user management, tags, folders, system backup
/stream/*Public or 60s Stream TokenReal-time live media delivery (WHEP WebRTC, WebCodecs WebSocket, HLS)
/hls/*Public / TokenDynamic on-demand archive playback (archive.m3u8, segment.ts)
/models/*PublicCached ONNX AI weights distribution hub (GET /models/:filename)
/livez, /readyzPublicKubernetes / Container health and readiness probes
/metricsPublic / ScraperStandard Prometheus metrics exporter

2. Standard JSON Responses & Error Format ​

Endpoints return direct, structured JSON objects.

Example Success Response (POST /api/login): ​

json
{
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}

Example Error Response: ​

json
{
  "error": "camera not found"
}

Standard Status Codes: ​

  • 200 OK: Request succeeded.
  • 201 Created: Entity (camera, user, tag, folder) created or WebRTC WHEP session initialized.
  • 400 Bad Request: Invalid JSON body or malformed parameters.
  • 401 Unauthorized: Missing or expired JWT / stream token.
  • 403 Forbidden: Insufficient RBAC role permissions.
  • 404 Not Found: Requested camera, user, or archive file does not exist.
  • 500 Internal Server Error: Storage failure or engine error.

3. Real-Time Log Streaming (SSE) ​

Admins and operators can subscribe to server log events via Server-Sent Events (SSE):

http
GET /api/logs/stream
Authorization: Bearer <JWT_TOKEN>
Accept: text/event-stream

Released under the MIT License.