Show last authors
1 == MTA Bus Time and the OneBusAway API ==
2
3 MTA Bus Time is powered (in part) by the open source {{html}}<a href="https://github.com/OneBusAway/onebusaway/wiki">OneBusAway</a>{{/html}} (OBA) software. While MTA Bus Time's SIRI API is a new addition to the OBA project, OBA does have its own (non-standards-based) RESTful developer API. MTA Bus Time now exposes a modified version of the OBA RESTful API, as described below. The primary modification is to exclude all real-time data, which in the context of MTA Bus Time should come from the standards-based SIRI API.
4
5 == Documentation ==
6
7 The documentation for the OBA RESTful API is available {{html}}<a href="https://developer.onebusaway.org/modules/onebusaway-application-modules/current/api/where/index.html">online</a>{{/html}}. The modifications to this API with respect to MTA Bus Time are described {{html}}<a href="https://github.com/OneBusAway/onebusaway-application-modules/wiki/RESTful-API-Roadmap">here</a>{{/html}}. This API will allow you to "discover" static/baseline information about the bus services covered under MTA Bus Time. It is, effectively, a set of web services that gives you convenient HTTP-based access to selected subsets of information otherwise available from the GTFS schedule files. This API provides, for example:
8
9 * The list of routes covered by MTA Bus Time
10 * Full information about each stop covered by MTA Bus Time (e.g. the lat/lon coordinates, stop name, list of routes serving that stop)
11 * The stops served by a given route
12 * The physical geometry for a given route (for mapping and geographic calculations)
13 * The schedule of trips serving a given stop or route (repeat: //schedule//, having nothing to do with the real-time data)
14 * The stops or routes near a given location
15
16
17 == Access ==
18 The root of the OBA API in the MTA Bus Time deployment is ## https://bustime.mta.info/api/where/ ##. So, for example:
19
20 * To get the list of and metadata for the agencies covered by MTA Bus Time, use: {{html}}<a href="https://bustime.mta.info/api/where/agencies-with-coverage.xml?key=YOUR_KEY_HERE">https://bustime.mta.info/api/where/agencies-with-coverage.xml?key=YOUR_KEY_HERE</a>{{/html}}
21 * To get the list of and metadata for the MTA NYCT and MTABC routes covered by MTA Bus Time, use: {{html}}<a href="https://bustime.mta.info/api/where/routes-for-agency/MTA%20NYCT.xml?key=YOUR_KEY_HERE">https://bustime.mta.info/api/where/routes-for-agency/MTA%20NYCT.xml?key=YOUR_KEY_HERE</a>{{/html}}
22 * For information on one specific stop served by MTA Bus Time, use: {{html}}<a href="https://bustime.mta.info/api/where/stop/MTA_STOP-ID.xml?key=YOUR_KEY_HERE">https://bustime.mta.info/api/where/stop/MTA_STOP-ID.xml?key=YOUR_KEY_HERE</a>{{/html}}
23 * For information on the stops that serve a route, use <a href="https://bustime.mta.info/api/where/stops-for-route/MTA%20NYCT_M1.json?key=YOUR_KEY_HERE&includePolylines=false&version=2">https://bustime.mta.info/api/where/stops-for-route/MTA%20NYCT_M1.json?key=YOUR_KEY_HERE&includePolylines=false&version=2</a>{{/html}}
24 * For information on stops near a location, use {{html}}<a href="https://bustime.mta.info/api/where/stops-for-location.json?lat=40.748433&lon=-73.985656&latSpan=0.005&lonSpan=0.005&key=YOUR_KEY_HERE">https://bustime.mta.info/api/where/stops-for-location.json?lat=40.748433&lon=-73.985656&latSpan=0.005&lonSpan=0.005&key=YOUR_KEY_HERE</a>{{/html}}
25 * and so on...
26
27
28 Please use the same API key for the OBA API as for the SIRI API.