Developers
Base URL:
API Reference
Every FlowGrid capability is available as a JSON API. All POST bodies are JSON objects; invalid input returns 400 with an error message.
GET
/api/health
Service status and version.
// Response appears here
GET
/api/network
Intersections, roads (length, class, capacity) and the adjacency list.
// Response appears here
GET
/api/live?minute=510
Traffic snapshot at a simulated minute: KPIs, per-road congestion, junction load, incidents and alerts.
// Response appears here
POST
/api/route
Shortest route with one algorithm. metric: distance | freeflow | live. algorithm: dijkstra | astar | bfs | bellman_ford.
// Response appears here
POST
/api/route/compare
Run all four algorithms on the same graph and report cost, nodes expanded and solve time.
// Response appears here
POST
/api/route/alternatives
k loop-free alternative routes (Yen's algorithm), k ≤ 5.
// Response appears here
POST
/api/emergency
Emergency green corridor to a destination (default City Hospital) with signal pre-emption schedule.
// Response appears here
POST
/api/signals/webster
Webster optimum cycle, green split, delay and level of service per approach.
// Response appears here
POST
/api/signals/optimize
Bounded proportional green-time split from measured queues.
// Response appears here
POST
/api/simulation/run
Simulate one control strategy: fixed | webster | adaptive | actuated.
// Response appears here
POST
/api/simulation/compare
Simulate all strategies on identical arrivals over several replications.
// Response appears here
GET
/api/forecast?node=CEN
Holt-Winters 24-hour demand forecast for a junction, with back-test against a seasonal-naive baseline.
// Response appears here
GET
/api/analytics/network
Kruskal MST, Floyd–Warshall travel-time matrix, graph centre and closeness ranking.
// Response appears here
GET
/api/benchmark
Scaling benchmark of the route solvers on graphs up to 10,000 vertices (cached).
// Response appears here
Conventions
- Junction ids are 3-letter codes (e.g.
CEN,HSP) from/api/network. - Road ids look like
CEN-MKTand are used inclosures. minutecounts simulated minutes from Monday 00:00 (510 = Mon 08:30).- Flows are vehicles per hour; times are seconds unless named
_min. - Request bodies are limited to 64 KB.
- Responses carry strict security headers including a nonce-based Content-Security-Policy.
Quick start
curl -s -X POST /api/route \
-H 'Content-Type: application/json' \
-d '{"start":"AIR","goal":"HSP",
"algorithm":"astar","metric":"live"}'