Skip to content

Instantly share code, notes, and snippets.

@Bizzaro
Forked from grantland/README.md
Last active September 19, 2022 04:52
Show Gist options
  • Save Bizzaro/1889b61117bdff824210beebe1b2f868 to your computer and use it in GitHub Desktop.
Save Bizzaro/1889b61117bdff824210beebe1b2f868 to your computer and use it in GitHub Desktop.
NextBus API

NextBus API

http://www.nextbus.com/xmlFeedDocs/NextBusXMLFeed.pdf

Replace publicJSONFeed with publicXMLFeed if you want XML.

Agency list

Obtain a list of available transit agencies.

https://webservices.umoiq.com/service/publicJSONFeed?command=agencyList

Route list

Obtain a list of routes for a given agency. The agency is specified by the "a" parameter in the query string. The tag for the agency is obtained from the agencyList command.

https://webservices.umoiq.com/service/publicJSONFeed?command=routeList&a=<agency_tag>
https://webservices.umoiq.com/service/publicJSONFeed?command=routeList&a=ttc

Route config

Obtain a list of routes for a given agency. The route is optionally specified by the "r" parameter. The tag for the route is obtained using the routeList command. If the "r" parameter is not specified, all routes for the agency are returned, limited to 100 routes per request.

https://webservices.umoiq.com/service/publicJSONFeed?command=routeConfig&a=<agency_tag>&r=<route tag> 
https://webservices.umoiq.com/service/publicJSONFeed?command=routeConfig&a=ttc&r=97

Predictions

Obtain predictions associated with a particular stop. There are two ways to specify the stop: 1) using a stopId or 2) by specifying the route and stop tags.​

https://webservices.umoiq.com/service/publicJSONFeed?command=predictions&a=<agency_tag>&r=<route tag>&stopId=<stop tag>
https://webservices.umoiq.com/service/publicJSONFeed?command=predictions&a=ttc&r=97&stopId=12004

Predictions for multi stops

To obtain predictions associated with multiple stops use the "predictionsForMultiStops" command. The stops are specified by using the "stops" parameter multiple times.

https://webservices.umoiq.com/service/publicJSONFeed?command=predictionsForMultiStops&a=<agency_tag>&stops=<stop 1>&stops=<stop 2>&stops=<stop 3>

Schedule

Obtain the schedule information for a route. The route is specified by the "r" parameter. The tag for the route is obtained using the routeList command.

https://webservices.umoiq.com/service/publicJSONFeed?command=schedule&a=<agency_tag>&r=<route_tag>
https://webservices.umoiq.com/service/publicJSONFeed?command=schedule&a=ttc&r=97

Vehicle locations

Obtain a list of vehicle locations that have changed since the last time the vehicleLocations command was used. The "t" parameter specifies the last time that was returned by the vehicleLocations command. The time is in msec since the 1970 epoch time. If you specify a time of 0, then data for the last 15 minutes is provided.

https://webservices.umoiq.com/service/publicJSONFeed?command=vehicleLocations&a=<agency_tag>&r=<route tag>&t=<epoch time in msec> 
https://webservices.umoiq.com/service/publicJSONFeed?command=vehicleLocations&a=ttc&r=97&t=1663557760270

Messages

Obtain messages currently active for a route or a group of routes. Note: this command only returns currently active messages. If a message is configured just to be shown on Tuesdays for example but it is currently Wednesday then the message will not be listed.

https://webservices.umoiq.com/service/publicJSONFeed?command=messages&a=<agency tag>&r=<route tag1>&r=<route tagN> 

Haven't seen actual data here, but in theory

https://webservices.umoiq.com/service/publicJSONFeed?command=messages&a=ttc&r=97
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment