Schedule Information API
Command: routesched
Inputs
Parameter | Description |
---|---|
cmd=routesched | Requests detailed schedule information for a specific route. (Required) |
route=<route_num> | Specifies a route information to return (i.e. 1, 2, ... 12). (Required) |
key=<key> | API registration key. (Required) |
date=<mm/dd/yyyy> or <wd|sa|su> |
Specifies which date to use. This will determine the appropriate schedule for that date, and give back information about the lines for that schedule. Date can also be specified as "today" or "now". New options for generic schedules have been added: "wd", "sa", and "su" for weekday, Saturday and Sunday. (Optional) |
l=<number> | Specifies whether the legend information should be included. By default it is 0 (not shown), but can be turned on by setting it to 1. (Optional) |
json=y | Returns API output in JSON format. Default output is XML if parameter not specified. (Optional) |
Notes
- Route Information sometimes changes with schedule changes as lines are reconfigured. This may affect the name and abbreviation of the route.
Results
XML Sample
<?xml version="1.0" encoding="utf-8"?> <root> <uri> <![CDATA[https://api.bart.gov/api/sched.aspx?cmd=routesched&route=6&time=12:47+am]]> </uri> <date>1/18/2017</date> <route> <train index="1"> <stop station="DALY" load="1" origTime="6:13 AM" bikeflag="1"/> <stop station="BALB" load="1" origTime="6:17 AM" bikeflag="1"/> <stop station="GLEN" load="1" origTime="6:19 AM" bikeflag="1"/> <stop station="24TH" load="1" origTime="6:22 AM" bikeflag="1"/> <stop station="16TH" load="1" origTime="6:24 AM" bikeflag="1"/> <stop station="CIVC" load="1" origTime="6:26 AM" bikeflag="1"/> <stop station="POWL" load="1" origTime="6:27 AM" bikeflag="1"/> <stop station="MONT" load="1" origTime="6:29 AM" bikeflag="1"/> <stop station="EMBR" load="1" origTime="6:30 AM" bikeflag="1"/> <stop station="WOAK" load="1" origTime="6:37 AM" bikeflag="1"/> <stop station="LAKE" load="1" origTime="6:43 AM" bikeflag="1"/> <stop station="FTVL" load="1" origTime="6:46 AM" bikeflag="1"/> <stop station="COLS" load="1" origTime="6:50 AM" bikeflag="1"/> <stop station="SANL" load="1" origTime="6:54 AM" bikeflag="1"/> <stop station="BAYF" load="1" origTime="6:57 AM" bikeflag="1"/> <stop station="HAYW" load="1" origTime="7:01 AM" bikeflag="1"/> <stop station="SHAY" load="1" origTime="7:05 AM" bikeflag="1"/> <stop station="UCTY" load="1" origTime="7:10 AM" bikeflag="1"/> <stop station="FRMT" load="1" origTime="7:16 AM" bikeflag="1"/> </train> ... <train index="52"> <stop station="DALY" load="1" origTime="6:58 PM" bikeflag="1"/> <stop station="BALB" load="1" origTime="7:02 PM" bikeflag="1"/> <stop station="GLEN" load="1" origTime="7:04 PM" bikeflag="1"/> <stop station="24TH" load="1" origTime="7:07 PM" bikeflag="1"/> <stop station="16TH" load="1" origTime="7:09 PM" bikeflag="1"/> <stop station="CIVC" load="1" origTime="7:11 PM" bikeflag="1"/> <stop station="POWL" load="1" origTime="7:12 PM" bikeflag="1"/> <stop station="MONT" load="1" origTime="7:14 PM" bikeflag="1"/> <stop station="EMBR" load="1" origTime="7:15 PM" bikeflag="1"/> <stop station="WOAK" load="1" origTime="7:22 PM" bikeflag="1"/> <stop station="LAKE" load="1" origTime="7:28 PM" bikeflag="1"/> <stop station="FTVL" load="1" origTime="7:31 PM" bikeflag="1"/> <stop station="COLS" load="1" origTime="7:35 PM" bikeflag="1"/> <stop station="SANL" load="1" origTime="7:39 PM" bikeflag="1"/> <stop station="BAYF" load="1" origTime="7:42 PM" bikeflag="1"/> <stop station="HAYW" load="1" origTime="7:46 PM" bikeflag="1"/> <stop station="SHAY" load="1" origTime="7:50 PM" bikeflag="1"/> <stop station="UCTY" load="1" origTime="7:55 PM" bikeflag="1"/> <stop station="FRMT" load="1" origTime="8:01 PM" bikeflag="1"/> </train> </route> <message> <![CDATA[Elevator to Fremont platform out for new flooring 1/17-20. <a href="https://www.bart.gov/news/articles/2017/news20170109">Read more...</a><br><br>Elevator out for flooring repair at MacArthur 1/17 to 1/20. <a href="https://www.bart.gov/news/articles/2017/news20170103-2">Read more...</a><br><br>Pleasant Hill parking garage elevators will be out of service one at a time through 2017. <a href="https://www.bart.gov/news/articles/2016/news20161130">Read more...</a>]]> </special_schedule> </message> </root>
JSON Sample
{ "?xml":{ "@version":"1.0", "@encoding":"utf-8" }, "root":{ "uri":{ "#cdata-section":"https://api.bart.gov/api/sched.aspx?cmd=routesched&route=6&time=12:47+am&json=y" }, "date":"6/27/2017", "route":{ "train":[ { "@index":"1", "stop":[ { "@station":"DALY", "@load":"", "@bikeflag":"1" }, { "@station":"BALB", "@load":"", "@bikeflag":"1" }, { "@station":"GLEN", "@load":"", "@bikeflag":"1" }, { "@station":"24TH", "@load":"", "@bikeflag":"1" }, { "@station":"16TH", "@load":"", "@bikeflag":"1" }, { "@station":"CIVC", "@load":"", "@bikeflag":"1" }, { "@station":"POWL", "@load":"", "@bikeflag":"1" }, { "@station":"MONT", "@load":"", "@bikeflag":"1" }, { "@station":"EMBR", "@load":"", "@bikeflag":"1" }, { "@station":"WOAK", "@load":"", "@bikeflag":"1" }, { "@station":"LAKE", "@load":"", "@bikeflag":"1" }, { "@station":"FTVL", "@load":"", "@bikeflag":"1" }, { "@station":"COLS", "@load":"", "@bikeflag":"1" }, { "@station":"SANL", "@load":"", "@bikeflag":"1" }, { "@station":"BAYF", "@load":"", "@bikeflag":"1" }, { "@station":"HAYW", "@load":"", "@bikeflag":"1" }, { "@station":"SHAY", "@load":"", "@bikeflag":"1" }, { "@station":"UCTY", "@load":"1", "@origTime":"4:41 AM", "@bikeflag":"1" }, { "@station":"FRMT", "@load":"1", "@origTime":"4:46 AM", "@bikeflag":"1" }, { "@station":"WARM", "@load":"1", "@origTime":"4:53 AM", "@bikeflag":"1" } ] }, { "@index":"62", "stop":[ { "@station":"DALY", "@load":"1", "@origTime":"6:56 PM", "@bikeflag":"1" }, { "@station":"BALB", "@load":"1", "@origTime":"7:00 PM", "@bikeflag":"1" }, { "@station":"GLEN", "@load":"1", "@origTime":"7:02 PM", "@bikeflag":"1" }, { "@station":"24TH", "@load":"1", "@origTime":"7:05 PM", "@bikeflag":"1" }, { "@station":"16TH", "@load":"1", "@origTime":"7:07 PM", "@bikeflag":"1" }, { "@station":"CIVC", "@load":"1", "@origTime":"7:09 PM", "@bikeflag":"1" }, { "@station":"POWL", "@load":"1", "@origTime":"7:11 PM", "@bikeflag":"1" }, { "@station":"MONT", "@load":"1", "@origTime":"7:12 PM", "@bikeflag":"1" }, { "@station":"EMBR", "@load":"2", "@origTime":"7:14 PM", "@bikeflag":"1" }, { "@station":"WOAK", "@load":"2", "@origTime":"7:21 PM", "@bikeflag":"1" }, { "@station":"LAKE", "@load":"2", "@origTime":"7:26 PM", "@bikeflag":"1" }, { "@station":"FTVL", "@load":"1", "@origTime":"7:30 PM", "@bikeflag":"1" }, { "@station":"COLS", "@load":"1", "@origTime":"7:33 PM", "@bikeflag":"1" }, { "@station":"SANL", "@load":"1", "@origTime":"7:37 PM", "@bikeflag":"1" }, { "@station":"BAYF", "@load":"1", "@origTime":"7:41 PM", "@bikeflag":"1" }, { "@station":"HAYW", "@load":"1", "@origTime":"7:45 PM", "@bikeflag":"1" }, { "@station":"SHAY", "@load":"1", "@origTime":"7:48 PM", "@bikeflag":"1" }, { "@station":"UCTY", "@load":"1", "@origTime":"7:53 PM", "@bikeflag":"1" }, { "@station":"FRMT", "@load":"1", "@origTime":"7:58 PM", "@bikeflag":"1" }, { "@station":"WARM", "@load":"1", "@origTime":"8:05 PM", "@bikeflag":"1" } ] } ] }, "message":{ "special_schedule":{ "#cdata-section":"Some Pleasant Hill parking garage elevators will be out of service through 2017. <a href=\"https://www.bart.gov/news/articles/2016/news20161130\">Read more...</a>" } } } }
Notes
- The "index" attribute of the <train> has been deprecated and the "trainIdx" attribute should be used instead.
- Any error messages will be included in an <error> item under the <message> element.
Usage
XML: https://api.bart.gov/api/sched.aspx?cmd=routesched&route=6&key=INSERT-KEY&time=12:47+am
JSON: https://api.bart.gov/api/sched.aspx?cmd=routesched&route=6&key=INSERT-KEY&time=12:47+am&json=y