-
Notifications
You must be signed in to change notification settings - Fork 0
For all requests the server must give back a JSON response.
-
http://{server_host}/get_routes
In the future we might support several bus routes. Therefore we must build in the ability to store times for multiple bus routes. This method will retrieve all of the available bus routes. Having the
idof a bus route, we can use issue other requests to get times information for a particular bus route.The server's response:
[{ "routes": [ { "id": "1", "name": "Some bus route" }, { "id": "2", "name": "Cool route" } ] }]Where
idis a route's unique reference identifier [number], andnameis a human readable English name which the user will see. -
http://{server_host}/get_route_info?route={route_id}
Retrieve some metadata about the route. A bus can have different schedules for different days. Metadata will contain a list of all days that the bus is available, even if some days will differ from others. Also, the metadata will contain all bus stops which it will visit on some day (not necessarily all of them, and in the order specified). This is general information for the user to decide whether it is a relevant bus or not.
The server's response:
[{ "days": ["0", "1", "2", "3", "4", "5", "6"], "startDate": "1391424290", "endDate": "1391454342", "busStops": ["T. Shevchenka", "Rialto", "Other"] }]The properties
startDate, andendDateare UNIX timestamps in UTC for the date (and time) of when the bus schedule becomes active, and when it will stop functioning.daysis a list of all days when the bus will function (0 being Monday, 1 being Tuesday, ..., 6 being Sunday).busStopsis a list of all bus stops where the bus might stop. -
http://{server_host}/get_latest?route={route_id}
To get the latest times for a particular bus route with the
idbeing{route_id}, this request can be issued. It will return two times. The next near time when a bus is leaving, and the next time after that. This is for convenience, since most of the time the user will want to know when is the next bus leaving. Having the next near time, we can calculate on the front end how much time is left.The server's response:
[{ "next": "1391424290", "afterNext": "1391454342" }]The properties
next, andafterNextare UNIX timestamps in UTC for the date (and time) of next near time bus departure, and the next time after. -
http://{server_host}/get_all?route={route_id}
This request will retrieve the entire bus time schedule for a particular bus route with the
idbeing{route_id}.The server's response: please see Schedule data format.