This document describes the current Janus HTTP and WebSocket API.
The server binary is:
cargo run --bin http_server -- --host 127.0.0.1 --port 8080 --storage-dir ./data/storageGET /health
Returns a service health payload with storage background-flush status.
Healthy response:
{
"status": "ok",
"message": "Janus HTTP API is running",
"storage_status": "ok",
"storage_error": null
}If background storage flushing has failed, the endpoint returns HTTP 503 Service Unavailable with:
{
"status": "degraded",
"message": "Janus HTTP API is running with storage errors",
"storage_status": "error",
"storage_error": "Background flush failed: ..."
}GET /ops/status
Returns a richer operational snapshot with:
- overall service status
- storage background-flush health
- replay metrics
- query lifecycle counts
POST /api/queries
Request body:
{
"query_id": "anomaly_q1",
"janusql": "PREFIX ex: <http://example.org/> ...",
"baseline_mode": "aggregate"
}baseline_mode is optional and accepts:
aggregatelast
If the Janus-QL query contains USING BASELINE ..., that query-level clause overrides this registration default at execution time.
GET /api/queries
Response shape:
{
"queries": ["q1", "q2"],
"total": 2
}GET /api/queries/:id
Response includes:
query_idquery_textbaseline_moderegistered_atexecution_countis_runningstatus
Possible status values include:
RegisteredWarmingBaselineRunningStoppedFailed(...)
POST /api/queries/:id/start
Starts execution and creates the internal forwarder used for WebSocket subscribers.
POST /api/queries/:id/stop
Stops a running query.
DELETE /api/queries/:id
Deletes a stopped query from the registry.
WS /api/queries/:id/results
WebSocket messages are JSON-encoded query results containing:
query_idtimestampsourcebindings
source is either:
HistoricalLive
POST /api/replay/start
Starts replay from an N-Triples or N-Quads input file. The request accepts:
{
"input_file": "data/sensors.nq",
"broker_type": "mqtt",
"topics": ["sensors"],
"rate_of_publishing": 64,
"loop_file": false,
"add_timestamps": true,
"mqtt_config": {
"host": "localhost",
"port": 1883,
"client_id": "janus-replay",
"keep_alive_secs": 30
}
}broker_type is mqtt or none. If omitted, it defaults to none; topics,
rate, and timestamp insertion also have server defaults. Only one replay can
run at a time.
POST /api/replay/stop
Stops the active replay. It returns a bad request when no replay is running.
GET /api/replay/status
Returns whether replay is running plus read, published, stored, and error counts, events per second, and elapsed seconds.
POST /api/queriesPOST /api/queries/:id/start- Connect
WS /api/queries/:id/results - Read query results
POST /api/queries/:id/stopDELETE /api/queries/:id
The implementation retains baseline-oriented compatibility behavior. A query
using that internal path may enter WarmingBaseline after start, and
baseline-dependent joins can produce results only after warm-up completes.
This is not a public Janus-QL language guarantee; see
BASELINES.md for the boundary.