Routes

A route: id, name, state (not_assigned, waiting, declined, running, finished), courier, day, sent, started, finished, and how many stops, delivered and notDelivered, with the money collected. No line, distance or planned times: those are Google’s.

GET /v1/routes, GET /v1/routes/{id}

A day’s routes (day, today by default); one route with its stops in order (stopsList).

POST /v1/routes/{id}/send

{ "courier": "…" }: a route not started, given to a courier (one not assigned, declined, or with someone else). Their phone tells them. It comes back with a new id, as in Routr Dispatch.

POST /v1/routes/{id}/take-back

A route not started, taken off its courier and kept, not assigned to anyone.

DELETE /v1/routes/{id}

A route not started, deleted. Its stops from Waiting go back there (backInWaiting says how many).

POST /v1/routes/{id}/stops

{ "stops": ["…"] }: up to 25 stops waiting for a route, added to a running one. The courier’s phone fits each in where it adds least. A stop needs a place on the map first: a customer’s pin, or planning it in Routr Dispatch within the last day.