Location¶
Endpoints for updating driver location and searching for nearby drivers. See Location Strategy for the two-store architecture.
Update driver location (Redis)¶
POST /redis/driver/location ๐ DRIVER
The primary location update path. Writes to Redis Geo. If the driver has an active IN_PROGRESS ride, automatically pushes coordinates to the customer via WebSocket.
Note
This endpoint is under /redis/, not /api/. It does not require the /api prefix.
Request body
json
{
"lat": 43.6511,
"lon": -79.3470
}
Response 200 OK
Location updated for driver 7
Side effect when ride is IN_PROGRESS:
/topic/customer/{customerId}/driver-locationโ{ "lat": 43.6511, "lon": -79.3470 }
Update driver location (PostGIS)¶
POST /driver/location ๐ DRIVER
Writes the driver's current position to PostGIS (driver_location table). Also broadcasts to /topic/driver-location/{driverId} via WebSocket.
Note
No /api prefix. This endpoint is served under the root path.
Request body
json
{
"lat": 43.6511,
"lon": -79.3470
}
Response 200 OK
json
{
"driverId": 7,
"status": 200
}
Update driver online status¶
POST /drivers/my-status ๐ DRIVER
Sets the driver's online status and active vehicle. Going ONLINE requires all three document types to have at least one approved document.
Note
No /api prefix.
Request body
json
{
"onlineStatus": "ONLINE",
"vehicleId": 3
}
onlineStatus values: ONLINE ยท OFFLINE
Response 200 OK โ LocationUpdateResponse (empty fields)
Error responses
| Status | Condition |
|---|---|
409 Conflict |
Missing approved LICENSE, INSURANCE, or REGISTRATION document |
404 Not Found |
Vehicle not found |
Search nearby drivers (Redis)¶
GET /redis/nearby Public
Fast nearby search using Redis Geo. This is the recommended path for customer-facing nearby search.
Query parameters
| Param | Type | Default | Description |
|---|---|---|---|
lat |
double | required | Search center latitude |
lon |
double | required | Search center longitude |
radiusMeters |
double | 2000 |
Search radius in meters |
limit |
int | 20 |
Max results |
Example
GET /redis/nearby?lat=43.6511&lon=-79.3470&radiusMeters=3000&limit=10
Response 200 OK
json
[
{
"driverId": 7,
"lat": 43.6523,
"lon": -79.3481,
"distanceMeters": 148.5,
"topic": "/topic/driver-location/7"
}
]
Search nearby drivers (PostGIS)¶
GET /api/drivers/nearby ๐ CUSTOMER
Nearby search using PostGIS ST_DWithin. Slower than the Redis path but queries persisted location data.
Query parameters
| Param | Type | Default | Description |
|---|---|---|---|
lat |
double | required | Search center latitude |
lon |
double | required | Search center longitude |
radiusMeters |
double | 2000 |
Search radius in meters |
limit |
int | 20 |
Max results |
Response 200 OK โ same schema as /redis/nearby