For Developers Index - OneBusAway RESTful API

Page / - last modified by admin admin on 2023/09/13 12:51

OneBusAway RESTful API

last modified by admin admin

on 2023/09/13 12:51

Table of Contents

MTA Bus Time and the OneBusAway API

Documentation

Access

MTA Bus Time and the OneBusAway API

MTA Bus Time is powered (in part) by the open source OneBusAway (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.

Documentation

The documentation for the OBA RESTful API is available online. The modifications to this API with respect to MTA Bus Time are described here. 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:

The list of routes covered by MTA Bus Time

Full information about each stop covered by MTA Bus Time (e.g. the lat/lon coordinates, stop name, list of routes serving that stop)

The stops served by a given route

The physical geometry for a given route (for mapping and geographic calculations)

The schedule of trips serving a given stop or route (repeat: schedule, having nothing to do with the real-time data)

The stops or routes near a given location

Access

The root of the OBA API in the MTA Bus Time deployment is https://bustime.mta.info/api/where/ . So, for example:

To get the list of and metadata for the agencies covered by MTA Bus Time, use: https://bustime.mta.info/api/where/agencies-with-coverage.xml?key=YOUR_KEY_HERE

To get the list of and metadata for the MTA NYCT and MTABC routes covered by MTA Bus Time, use: https://bustime.mta.info/api/where/routes-for-agency/MTA%20NYCT.xml?key=YOUR_KEY_HERE

For information on one specific stop served by MTA Bus Time, use: https://bustime.mta.info/api/where/stop/MTA_STOP-ID.xml?key=YOUR_KEY_HERE

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}}

For information on stops near a location, use 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

and so on...

Please use the same API key for the OBA API as for the SIRI API.