Hi,
Please visit our documentation to see the available endpoints and filters available. To request the routes for light and heavy rail, you could use:
https://api-v3.mbta.com/routes?filter[type]=0,1
To request stops for a given list of routes, you could obtain the routes from the above request and use:
https://api-v3.mbta.com/stops?filter[route]=Red,Orange,Blue,...
For making requests in python, I recommend the requests library. The code to fetch the data from the above URLs would be something like:
import requests
resp = requests.get("https://api-v3.mbta.com/....")
resp.json()
If you're going to be making frequent requests, please register with us to obtain an API key, which will increase your rate limit. You could then pass your API key like follows in the request:
requests.get("https://api-v3.mbta.com/...", headers={"x-api-key": "12345"})
-- Deveoper@MBTA
CAUTION: This email originated from outside of the MBTA organization. Do not click links, open attachments, or respond unless you recognize the sender and know the content is safe. |