APIMuni

APIMuni makes data from NextMuni.com easily accessible to developers. It currently supports data for the San Francisco Muni Line only. Data is returned in JSON format.

In the future, Latitude and Longitude coordinates and Arrival times for every stop will be added. XML format for output will also be supported.

You can contact me at apimuni _@_ dannyroa_dot_com. I blog at blog.dannyroa.com

Acknowledgements

Parts of the code are based on Mihasya's work on YourMuni (http://yourmuni.appspot.com). YourMuni's source is available on Github at http://github.com/mihasya/yourmuni/tree/master.

Methods

Routes

Parameters: None as of now. Default agency is San Francisco Muni

Sample Url: http://apimuni.appspot.com/routes

Sample Response:

[{"id": "F", "name": "F-Market & Wharves"}, {"id": "J", "name": "J-Church"}, {"id": "KT", "name": "KT-Ingleside\/Third Street"}, {"id": "L", "name": "L-Taraval"}, {"id": "M", "name": "M-Ocean View"}, {"id": "N", "name": "N-Judah"}, {"id": "S", "name": "S-Castro Shuttle"}, {"id": "1", "name": "1-California"}, {"id": "1AX", "name": "1AX-California A Express"}, {"id": "1BX", "name": "1BX-California B Express"}, {"id": "2", "name": "2-Clement"}, {"id": "3", "name": "3-Jackson"}, {"id": "4", "name": "4-Sutter"}, {"id": "5", "name": "5-Fulton"}, {"id": "6", "name": "6-Parnassus"}, {"id": "7", "name": "7-Haight"}, {"id": "9", "name": "9-San Bruno"}, {"id": "9AX", "name": "9AX-Bayshore A Exp"}, {"id": "9BX", "name": "9BX-Bayshore B Exp"}, {"id": "9X", "name": "9X-Bayshore Exp"}, {"id": "10", "name": "10-Townsend"}, {"id": "12", "name": "12-Folsom \/ Pacific"}, {"id": "14", "name": "14-Mission"}, {"id": "14L", "name": "14L-Mission Limited"}, {"id": "14X", "name": "14X-Mission Express"}, {"id": "16AX", "name": "16AX-Noriega A Exp"}, {"id": "16BX", "name": "16BX-Noriega B Exp"}, {"id": "17", "name": "17-Park Merced"}, {"id": "18", "name": "18-46th Avenue"}, {"id": "19", "name": "19-Polk"}, {"id": "20", "name": "20-Columbus"}, {"id": "21", "name": "21-Hayes"}, {"id": "22", "name": "22-Fillmore"}, {"id": "23", "name": "23-Monterey"}, {"id": "24", "name": "24-Divisadero"}, {"id": "26", "name": "26-Valencia"}, {"id": "27", "name": "27-Bryant"}, {"id": "28", "name": "28-19th Avenue"}, {"id": "28L", "name": "28L-19th Avenue Limited"}, {"id": "29", "name": "29-Sunset"}, {"id": "30", "name": "30-Stockton"}, {"id": "30X", "name": "30X-Marina Express"}, {"id": "31", "name": "31-Balboa"}, {"id": "31AX", "name": "31AX-Balboa A Express"}, {"id": "31BX", "name": "31BX-Balboa B Express"}, {"id": "33", "name": "33-Stanyan"}, {"id": "35", "name": "35-Eureka"}, {"id": "36", "name": "36-Teresita"}, {"id": "37", "name": "37-Corbett"}, {"id": "38", "name": "38-Geary"}, {"id": "38AX", "name": "38AX-Geary A Express"}, {"id": "38BX", "name": "38BX-Geary B Express"}, {"id": "38L", "name": "38L-Geary Limited"}, {"id": "39", "name": "39-Coit"}, {"id": "41", "name": "41-Union"}, {"id": "43", "name": "43-Masonic"}, {"id": "44", "name": "44-O'Shaughnessy"}, {"id": "45", "name": "45-Union\/Stockton"}, {"id": "47", "name": "47-Van Ness"}, {"id": "48", "name": "48-Quintara - 24th Street"}, {"id": "49", "name": "49-Mission-Van Ness"}, {"id": "52", "name": "52-Excelsior"}, {"id": "53", "name": "53-Southern Heights"}, {"id": "54", "name": "54-Felton"}, {"id": "56", "name": "56-Rutland"}, {"id": "66", "name": "66-Quintara"}, {"id": "67", "name": "67-Bernal Heights"}, {"id": "71", "name": "71-Haight-Noriega"}, {"id": "71L", "name": "71L-Haight-Noriega Limited"}, {"id": "74", "name": "74x-Culture Bus"}, {"id": "76", "name": "76-Marin Headlands"}, {"id": "80X_IB", "name": "80X-Gateway Express"}, {"id": "81X_IB", "name": "81X-Caltrain Express"}, {"id": "82X_IB", "name": "82X-Presidio Express"}, {"id": "88", "name": "88-B.A.R.T. Shuttle"}, {"id": "89", "name": "89-Laguna Honda"}, {"id": "90", "name": "90-Owl"}, {"id": "91", "name": "91-Owl"}, {"id": "108", "name": "108-Treasure Island"}, {"id": "K OWL", "name": "K-Owl"}, {"id": "L OWL", "name": "L-Owl"}, {"id": "M OWL", "name": "M-Owl"}, {"id": "N OWL", "name": "N-Owl"}, {"id": "T OWL", "name": "T-Owl"}, {"id": "59", "name": "Powell-Mason Cable Car"}, {"id": "60", "name": "Powell-Hyde Cable Car"}, {"id": "61", "name": "California Street Cable Car"}]

Directions

Parameters: route

Sample Url: http://apimuni.appspot.com/directions?route=30

Sample Response:

[{"id": "30_IB1", "name": "Inbound to Caltrain Depot"}, {"id": "30_OB3", "name": "Outbound to Broderick & Beach"}]

Stops

Parameters: route, direction

Sample Url: http://apimuni.appspot.com/stops?route=J&direction=J__IB2

Sample Response:

[{"cross_streets": "Green Division Yard", "id": "5448"}, {"cross_streets": "San Jose Ave & Ocean Ave", "id": "6275"}, {"cross_streets": "San Jose Ave & Santa Ynez Ave", "id": "6288"}, {"cross_streets": "San Jose Ave & Santa Rosa Ave", "id": "6284"}, {"cross_streets": "Glen Park Station", "id": "4787"}, {"cross_streets": "San Jose Ave & Randall St", "id": "6277"}, {"cross_streets": "30th St & Dolores St", "id": "3537"}, {"cross_streets": "Church St & 30th St", "id": "4000"}, {"cross_streets": "Church St & 29th St", "id": "3999"}, {"cross_streets": "Church St & 27th St", "id": "3998"}, {"cross_streets": "Church St & Clipper St", "id": "4003"}, {"cross_streets": "Church St & 24th St", "id": "3996"}, {"cross_streets": "Church St & 22nd St", "id": "3994"}, {"cross_streets": "Right Of Way & 21st St", "id": "6217"}, {"cross_streets": "Right Of Way & Liberty St", "id": "6222"}, {"cross_streets": "Right Of Way & 20th St", "id": "6215"}, {"cross_streets": "Right Of Way & 18th St", "id": "6213"}, {"cross_streets": "Church St & 16th St", "id": "3985"}, {"cross_streets": "Church St & Market St", "id": "7073"}, {"cross_streets": "Church St & Duboce Ave", "id": "4006"}, {"cross_streets": "Van Ness Station Inbound", "id": "5419"}, {"cross_streets": "Civic Center Station Inbound", "id": "5727"}, {"cross_streets": "Powell Station Inbound", "id": "5417"}, {"cross_streets": "Montgomery Station Inbound", "id": "5731"}, {"cross_streets": "Embarcadero Station Arr", "id": "6992"}]