Skip to content
Valera Rozuvan edited this page Feb 3, 2014 · 1 revision

Get requests

For all requests the server must give back a JSON response.

  1. 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 id of 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 id is a route's unique reference identifier [number], and name is a human readable English name which the user will see.

  2. 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, and endDate are UNIX timestamps in UTC for the date (and time) of when the bus schedule becomes active, and when it will stop functioning. days is a list of all days when the bus will function (0 being Monday, 1 being Tuesday, ..., 6 being Sunday). busStops is a list of all bus stops where the bus might stop.

  3. http://{server_host}/get_latest?route={route_id}

    To get the latest times for a particular bus route with the id being {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, and afterNext are UNIX timestamps in UTC for the date (and time) of next near time bus departure, and the next time after.

  4. http://{server_host}/get_all?route={route_id}

    This request will retrieve the entire bus time schedule for a particular bus route with the id being {route_id}.

    The server's response: please see Schedule data format.

Clone this wiki locally