bustimes.org
bustimes.org copied to clipboard
Getting departures from stop via API?
Hi @jclgoodwin
Thanks for your work on bustimes.org!
I was wondering if the current API allows for obtaining the departures from a specific stop through the API i.e. JSON, rather than the web interface?
I can see there's this path: https://bustimes.org/stops/9400ZZNOLCM2/departures within the JavaScript resources for the main website, but this is HTML formatted as a part that gets included in the main web interface overall and refreshes a div element.
I can do this: https://bustimes.org/api/stops/9400ZZNOLCM2/, but adding the depatures path throws a 404 Not Found, so I'm not sure if it is intended to be used this way?
Thank you!
There is – undocumented but used by a few things:
https://bustimes.org/stops/9400ZZNOLCM2/times.json https://bustimes.org/stops/9400ZZNOLCM2/times.json?limit=3 https://bustimes.org/stops/9400ZZNOLCM2/times.json?when=2024-02-03T12:30:00Z
Ah thank you! That makes sense.
In terms of external applications using this API, is this within the terms of service/usage or would you require further discussion around this area?
I have used this API in https://github.com/ukslim/my-bus-stops - letting you know as a courtesy, and to say thank you.
Please do let me know if this is a problem or there's a different endpoint you'd prefer me to use. I don't realistically expect it to become heavily used.