OpenBusAPI is the backend interface for the BusTracker App. It provides a gateway API to access transport location data from the Bus Open Data Service API. The API also provides an endpoint to download data on transport operators taken from the NOC Database.
Hosting the API requires a key for the backend location API, which can be obtained above.
The code searches for an environment variable OPEN_BUS_API_KEY or a plain text file api_key
in the parent directory.
The API uses the Flask framework, in order to run the interface, I recommend the fantastic uv package manager, which can be used to run the API directly with:
uv run open_bus_api
The Open Bus API provides the following endpoints:
| Endpoint | Description |
|---|---|
| / | The index page |
| /version | Returns the current version of the API |
| /location/area/min_latitude/min_longitude/max_latitude/max_longitude | Location data on vehicles within the area provided |
| /location/vehicle/vehicle_id | Location data on the vehicle with id vehicle_id |
| /operators/data | Fetch the vehicle operator database in JSON format |
| /operators/info/list | Provides a summary of the data fields in the operator database |
| /stops/area/min_latitude/min_longitude/max_latitude/max_longitude | Data on transport stops within the area provided |