Skip to main content

Route Planning — Developer Overview

The Route Planning V2 module lets dispatchers ingest delivery orders, review locations, configure fleet, run HERE route optimization, and export or assign plans to TCMS Planner. Integrations can push orders programmatically instead of using the Excel upload wizard.

Operators use plain-language actions in the wizard (Assign to planner, Export Route Plan, Send to Third Party). Internal REST paths are documented here for integrators and backend work — not shown on dispatcher screens.

API base path​

All route-planning REST resources are mounted under:

{context}/rest/route-planning/

Replace {context} with your deployment prefix (for example /transportsupplyproject or /tcms).

ConcernDetail
Backend packagetransportsupplyproject → in.greenorange.api.routeplanning.*
Primary ingest (integration)Webhook order ingest — POST …/webhook/orders
Alternate ingestMultipart POST …/upload (Excel/CSV from the wizard UI)
Tenant scopeWebhook: X-Tenant-Id header. Session APIs: tenant from servlet context + username / authKey query params
DatabaseStaging tables route_planning_session, route_planning_stop, route_planning_webhook_event, …
Frontend moduleTCMSBookingWebApp/src/modules/routePlanning/
Session status syncroutePlanningSessionStatusSync.js — wizard PUT transitions for browser optimize + legacy planner assign

Typical integration flow​

  1. Push orders via webhook → receive sessionId (status INGESTED).
  2. Open the wizard in TCMS Booking Web App at /route-planning/location-review (or later steps) using that sessionId, or continue purely via REST (GET/PUT session, POST …/optimize, etc.).
  3. Optimize — server POST …/optimize or browser HERE; session reaches OPTIMIZED (see Session lifecycle).
  4. Assign to planner — server POST …/commit-to-planner or legacy planner save + wizard status sync → COMMITTED.
  5. Monitor sessions in the app under Usage metrics & history → Session history.
  6. Track live execution via GET …/live-routes or Live Route Tracking in the UI (see Live tracking API).

REST API reference (high level)​

MethodPathDescription
POST/uploadMultipart Excel/CSV ingest
POST/webhook/ordersJSON webhook ingest
GET/sessions/{id}Session detail (includes status)
PUT/sessions/{id}Update depot, fleet, route setup, status (valid transitions only)
GET/sessions/{id}/stopsList stops
GET/sessions/{id}/vehiclesList vehicles
POST/sessions/{id}/optimizeServer HERE optimization
POST/sessions/{id}/optimize/retryRetry after OPTIMIZATION_FAILED
GET/sessions/{id}/optimization-resultLatest success result
GET/sessions/{id}/export/route-planRoute plan JSON
GET/sessions/{id}/export/load-planLoad plan JSON
POST/sessions/{id}/commit-to-plannerCreate Planner trips (requires server routes + OPTIMIZED)
POST/sessions/{id}/dispatch/exportHTTPS webhook dispatch
GET/usage-metricsDaily usage rollup
GET/healthOperator health snapshot
GET/live-routesOptimized routes + driver GPS for a planning date
GET/live-routes/routes/{routeId}/trailGPS breadcrumb trail and deviation analysis

Auth for session APIs: existing TCMS username + authKey query parameters.

Assign to planner — two persistence paths​

The wizard exposes one operator action (Assign to planner). Implementation:

Route sourceAPI on successSession status
Server optimization resultPOST …/commit-to-planner → PlannerService.savePlan + commit logCOMMITTED (backend)
Browser HERE snapshot onlyPOST /rest/planner/savePlanV2 (legacy planner) + wizard PUT …/sessions/{id}COMMITTED (wizard sync)

Duplicate assign blocked when status is COMMITTED (RP_COMMIT_008 on server path; UI disables assign on both optimization and assignment review).

Guides in this section​

GuideDescription
End-to-end flow (beginner guide)Plain-language wizard walkthrough for dispatchers
Webhook order ingestPush orders + pickup at ingest; HMAC signing, idempotency, Settings developer kit, Postman (3 demos)
Session lifecycle & status syncStatus transitions, wizard sync, mermaid diagram
Live route tracking APIGET /live-routes, trail, GPS matching, stop operational fields
Error codesStable RP_* codes for ingest, session, optimize, commit, dispatch
Related TCMS repo docs

The application repository also ships internal runbooks under docs/developer/route-planning/ (full workflow, QA checklist, production rollout, sample JSON payloads).