Advisory Information API
Command: bsa
Inputs
Parameter | Description |
---|---|
cmd=bsa | Requests current BART service advisory (BSA) information (Required) |
orig=<stn> | Only get messages for specified station. Defaults to "all". (Optional) [Note: currently only "orig=all" or leaving the orig parameter off are supported, the BART system does not currently provide station specific BSA messages.] |
key=<key> | API registration key (Required) |
json=y | Returns API output in JSON format. Default output is XML if parameter not specified. (Optional) |
Notes
Currently all BSA messages have a station code of "BART" signifying that they are system-wide. If future messages are tagged for specific stations, and a station is specified in the orig parameter, information will be provided for the specified station as well as any system-wide tagged messages. To get all messages, regardless of tags, specify "orig=all".
Results
XML Sample
With delay message <?xml version="1.0" encoding="iso-8859-1"?> <root> <uri> <![CDATA[https://api.bart.gov/api/bsa.aspx?cmd=bsa]]> </uri> <date>08/29/2013</date> <time>11:55:00 AM PDT</time> <bsa id="112978"> <station>BART</station> <type>DELAY</type> <description> <![CDATA[BART is running round-the-clock service during the labor day weekend bay bridge closure. More info at www.bart.gov or (510) 465-2278.]]> </description> <sms_text> <![CDATA[BART is running round-the-clock svc during labor day weekend bay bridge closure. More info at www.BART.gov or (510) 465-2278.]]> </sms_text> <posted>Wed Aug 28 2013 10:44 PM PDT</posted> <expires>Thu Dec 31 2037 11:59 PM PST</expires> </bsa> <message></message> </root>
JSON Sample
{ "?xml":{ "@version":"1.0", "@encoding":"utf-8" }, "root":{ "@id":"1", "uri":{ "#cdata-section":"https://api.bart.gov/api/bsa.aspx?cmd=bsa&json=y" }, "date":"06/26/2017", "time":"11:08:00 AM PDT", "bsa":[ { "station":"", "description":{ "#cdata-section":"No delays reported." }, "sms_text":{ "#cdata-section":"No delays reported." } } ], "message":"" } }
Notes
The "type" element will either be DELAY or EMERGENCY. The "sms_text" element is a shortened version of the "description" element for use with text messaging. This element might be longer than allowed in a single text message, so it might need to be broken up into several messages.
Usage
XML: https://api.bart.gov/api/bsa.aspx?cmd=bsa&key=INSERT-KEY
JSON: https://api.bart.gov/api/bsa.aspx?cmd=bsa&key=INSERT-KEY&json=y