SMSMyBus exposes its data via a programming interface. This page describes that interface.

getstops

Overview

The getstops method will return the geo locations for all stops of a specified route.

URL

http://api.smsmybus.com/v1/getstops

Fields

Name Value Description
key String (required) API access key
routeID String A two-digit value describing a valid route in the Metro system.
destination String A value describing a valid route endpoint in the Metro system. When a destination is included in the query, the results will be limited to the stops that are headed in that direction.

Examples

Retrieve all stops for route 3:

http://api.smsmybus.com/v1/getstops?key=xxx&routeID=03

Retrieve all stops for route 3 headed toward ETP:

http://api.smsmybus.com/v1/getstops?key=xxx&routeID=03&destination=ETP

Response

The response length is dependent on the particular request parameters. If the status field is 0, the response will be grouped by route, listing the details of each stop on that route.

No assumptions should be made about the order of the stops in the response.

{ "status" : "0", "timestamp" : "12:38pm", "routeID" : "03", "stops" : [ { "stopID" : "1391", "intersection" : "Atwood & Ohio", "latitude" : "43.0937715", "longitude" : "-89.3467281", "destination" : "ETP", }, { "stopID" : "1961", "intersection" : "Atwood & Rusk", "latitude" : "43.0924936", "longitude" : "-89.3528187", "destination" : "ETP", }, ... ... ], }

Error

An error is indicated by a non-zero status value. If the status value is non-zero, the description field will be present describing the error in plain English.

{ "status" : "-1", "description" : "Invalid request parameters", }

getnearbystops

Overview

The getnearbystops method will return the geo locations for all stops near a specified location.

URL

http://api.smsmybus.com/v1/getnearbystops

Fields

Name Value Description
key String (required) API access key
lat String (required) A geo-spaticial figure describing the latitude coordinate for a Metro stop.
lon String (required) A geo-spaticial figure describing the longitude coordinate for a Metro stop.
radius Integer The radius around the lat and lon parameters where you would like to search. The radius is in feet and must be less than 500. It defaults to 500.
routeID (not currently supported) String A two-digit value describing a valid route in the Metro system. If a routeID is provided, the results will be limited to stops that service that route.
destination String A value describing a valid route endpoint in the Metro system. When a destination is included in the query, the results will be limited to the stops that are headed in that direction.

Examples

Retrieve all stops for route 3 around a point on Atwood (43.0733673,-89.4014633):

http://api.smsmybus.com/v1/getnearbystops?key=xxx&lat=43.0733673&lon=-89.4014633&routeID=03

Response

The response length is dependent on the particular request parameters. If the status field is 0, the response will be grouped by route, listing the details of each stop on that route within the specified radius.

No assumptions should be made about the order of the stops in the response.

{ "status" : "0", "timestamp" : "12:38pm", "stop" : [ { "stopID" : "1391", "intersection" : "Atwood & Ohio", "latitude" : "43.0937715", "longitude" : "-89.3467281", "destination" : "ETP", }, { "stopID" : "1961", "intersection" : "Atwood & Rusk", "latitude" : "43.0924936", "longitude" : "-89.3528187", "destination" : "ETP", }, ... ... ], }

Error

An error is indicated by a non-zero status value. If the status value is non-zero, the description field will be present describing the error in plain English.

{ "status" : "-1", "description" : "Invalid request parameters", }

getstoplocation

Overview

The getstoplocation method will return the geo location for a specific stop.

URL

http://api.smsmybus.com/v1/getstoplocation

Fields

Name Value Description
key String (required) API access key
stopID String (required) A four-digit value describing a valid stop ID in the Metro system.

Examples

Retrieve the location of stop ID 1391:

http://api.smsmybus.com/v1/getstoplocation?key=xxx&stopID=1391

Response

The response length is going to fixed since this method only supports retreiving a ingle resource. If the status field is 0, the response will list the details of the requested stop.

{ "status" : "0", "timestamp" : "12:38pm", "stopID" : "1391", "intersection" : "Atwood & Ohio", "latitude" : "43.0937715", "longitude" : "-89.3467281", }

Error

An error is indicated by a non-zero status value. If the status value is non-zero, the description field will be present describing the error in plain English.

{ "status" : "-1", "description" : "Invalid request parameters", }

getvehicles

Overview

The getvehicles method will return the geo locatios for all buses currently driving a specified route.

URL

http://api.smsmybus.com/v1/getvehicles

Fields

Name Value Description
key String (required) API access key
routeID String (required) A two-digit value describing a valid route in the Metro system. If a routeID is provided, the results will be limited to stops that service that route.
direction String
(not yet supported)
A value describing a valid route endpoint in the Metro system. When a destination is included in the query, the results will be limited to the stops that are headed in that direction.
vehicleID String
(not yet supported)
A three-digit value describing a valid vehicle (bus) in the Metro system and currently driving a route. The vehicleID filter will only be applied to the specified routeID parameter.

Examples

Retrieve all vehicles for route 3:

http://api.smsmybus.com/v1/getvehicles?key=xxx&routeID=03

Retrieve all details for vehicle 991 of route 3:

http://api.smsmybus.com/v1/getvehicles?key=xxx&routeID=03&vehicleID=991

Response

The response length is dependent on the particular request parameters. If the status field is 0, the response will be grouped by route, listing the details of each stop on that route within the specified radius.

No assumptions should be made about the order of the stops in the response.

{ "status" : "0", "count" : "3", "routeID" : "07", "timestamp" : "1/15/2012 10:13:44 AM", "vehicles" : [ { "lat": "43.0863712", "lon": "-89.3601702", "direction": "WTP", "nextStop": "Jenifer & Ingersoll", "vehicleID": "943", "wifiAccess": false, "bikeRack": false, "wheelChairLift": false, "wheelChairAccessible": false }, { "lat": "43.0535659", "lon": "-89.4430852", "direction": "WTP", "nextStop": "West Transfer Point", "vehicleID": "937" "wifiAccess": false, "bikeRack": false, "wheelChairLift": false, "wheelChairAccessible": false }, { "lat": "43.0742107", "lon": "-89.3826771", "direction": "ETP", "nextStop": "Jenifer & Ingersoll", "vehicleID": "015", "wifiAccess": false, "bikeRack": false, "wheelChairLift": false, "wheelChairAccessible": false } ] }

Error

An error is indicated by a non-zero status value. If the status value is non-zero, the description field will be present describing the error in plain English.

{ "status" : "-1", "description" : "Invalid request parameters", }