Structural Monitoring Platform API

REST API for systems, sensors, logs, control commands, and data-service bridge integration

Overview

Authentication

JWT auth via /api/auth/* routes.

Protected APIs

All /api/* endpoints require Authorization: Bearer <token> unless noted.

Health Probes

Root-level probes available at /health, /health/live, /health/ready.

Socket.IO

Sensor namespace /sensor is exposed for real-time sensor communication.

Public Endpoints (No Token)

GET /
API documentation page
GET /status
Runtime status + storage and DB counters
GET /health
Comprehensive health check
GET /health/live
Liveness probe
GET /health/ready
Readiness probe

Auth Endpoints

POST /api/auth/login
Login and get JWT token
POST /api/auth/register
Create a new user account
GET /api/auth/me
Get current user profile
POST /api/auth/refresh
Refresh JWT token

Core API Endpoints

Systems & Architectures

GET/api/systems
List systems
GET/api/systems/{system_id}
Get system by id
POST/api/systems
Create system
PUT/api/systems/{system_id}
Update system
DELETE/api/systems/{system_id}
Delete system
GET/api/architectures
List architectures

Users & Organizations

GET/api/users
List users
GET/api/users/{user_id}
Get user
POST/api/users
Create user
PUT/api/users/{user_id}
Update user
DELETE/api/users/{user_id}
Delete user
GET/api/organizations
List organizations
GET/api/organizations/{org_id}
Get organization
GET/api/organizations/{org_id}/users
List organization users
POST/api/organizations
Create organization
PUT/api/organizations/{org_id}
Update organization
DELETE/api/organizations/{org_id}
Delete organization

Sensors

GET/api/sensors
List sensors
GET/api/sensors/{sensor_id}
Get sensor by id
GET/api/sensors/serial/{serial_number}
Get sensor by serial
GET/api/systems/{system_id}/sensors
List sensors in a system
POST/api/systems/{system_id}/sensors
Create sensor in system
PUT/api/systems/{system_id}/sensors/{sensor_id}
Update sensor
DELETE/api/systems/{system_id}/sensors/{sensor_id}
Delete sensor

Files & Storage

GET /api/files
List stored files (optional ?extension=.DAT)
GET /api/files/content?path={relative_path}
Get file content as JSON
GET /api/files/search?q={query}
Search files by name/path
GET/api/sensors/{sensor_id}/files
List sensor files
GET/api/sensors/{sensor_id}/latest
Get latest sensor file
GET/api/sensors/{sensor_id}/stats
Get sensor aggregates
GET/api/storage/stats
Storage statistics
GET/api/storage/structure
Storage folder summary

Time Series

GET/api/sensors/{sensor_id}/timeseries
Time series data (supports start, end, max_points)
GET/api/sensors/{sensor_id}/timeseries/range
Min/max available timestamps

Logs

GET/api/logs
List logs (filterable)
GET/api/logs/{log_id}
Get log by id
POST/api/logs
Create log entry
DELETE/api/logs/{log_id}
Delete log entry
GET/api/systems/{system_id}/logs
List system logs
GET/api/sensors/{sensor_id}/logs
List sensor logs
GET/api/logs/stats
Log statistics

Sensor Control Endpoints

GET/api/sensors/control/connected
List connected sensors
POST/api/sensors/control/{serial_number}/reset
Send reset command
POST/api/sensors/control/{serial_number}/restart
Send restart command
PUT/api/sensors/control/{serial_number}/rfchannel
Update RF channel
PUT/api/sensors/control/{serial_number}/ip
Update sensor IP address
GET/api/sensors/control/{serial_number}/status
Get sensor online status

Data-Service Bridge Endpoints

GET/api/data-service/status
Bridge connection status
POST/api/data-service/discover/{system_id}
Discover sensor serials and sync DB for the system
POST/api/data-service/select
Select target sensor (serial_number)
POST/api/data-service/command
Send raw command
GET/api/data-service/config/{serial_number}
Fetch sensor config via bridge
POST/api/data-service/set-sample-rate/{serial_number}
Set sample rate
POST/api/data-service/set-file-size/{serial_number}
Set file size
POST/api/data-service/reset/{serial_number}
Reset sensor
POST/api/data-service/start/{serial_number}
Start sensor
POST/api/data-service/stop/{serial_number}
Stop sensor
POST/api/data-service/save-config/{serial_number}
Save config on sensor
POST/api/data-service/disconnect
Disconnect bridge TCP session

Quick Start

# 1) Login and get token
curl -X POST http://localhost:5000/api/auth/login \
  -H "Content-Type: application/json" \
  -d '{"email":"user@example.com","password":"password123"}'

# 2) Use token for protected APIs
curl http://localhost:5000/api/systems \
  -H "Authorization: Bearer <TOKEN>"

# 3) Discover sensors from data-service for a system
curl -X POST http://localhost:5000/api/data-service/discover/1 \
  -H "Authorization: Bearer <TOKEN>"