Open simoncoggins opened 7 years ago
nice! I'll have a play around with that.
thanks
Have you found any more endpoints recently? I'm wanting to get all service location updates in a single call, rather than just for say bus 014
@simoncoggins I'm getting a bad request with the StopsNearby endpoint, do you have a simple example using curl I could try?
Looks like it's moved to StopNearby now (or I made a typo the first time):
Thanks mate! 👍
Has anyone found anything that describes the complete route of a service?
This looks like it:
https://www.metlink.org.nz/api/v1/ServiceMap/[ROUTE]
I'm finding these by using Chrome inspector on the website and looking for AJAX requests when I perform specific actions, so you might be able to find more if you know what you're looking for.
Nice! I was taking a look while trying to use the plan function of the website, but I didn't see any requests to the API other than to the two endpoints that @reedwade has documented. They really should make the API public 🤷♂️
Inside the StopDepartures, it actually lists VehicleRef":"1674".....wonder if there's a call to find out where that bus is, ie it's current stop.
Rather than just polling the stop you're at. Be interesting to poke GPS data at something like traccar which is a gps tracking site and show locations of bus routes/train routes you care about.
More endpoints:
https://www.metlink.org.nz/api/v1/ServiceLocation/<service_code>
@zacps - Don't use the mapdatajson endpoint, it's incomplete and will be removed soon.
Instead use /api/v1/ServiceMap/
@nzphoenix Only tangentially related to this issue but I couldn't find your a way to contact you anywhere else.
Is there a way to get an identifier for a single run of a service?
It's possible to get something close with (ServiceID + VehicleRef)
and then time-limiting it, but I feel like there must be a better way?
Also if there are any other endpoints you could point us in the direction of that would be much appreciated.
@zacps - There's not a way to get that, but I can't help much further sorry. It's just what the website requires for it's own usage that exist within the API endpoints.
Hi, according to this OIA response, there'll be a public API released in about a month's time. Might be something to keep an eye out for, if you're still interested:
cool! I really need to tidy this whole thing up
I attend this recent talk which relates-- https://www.youtube.com/watch?v=Ier5BF952Y8
I found a few more endpoints, in case you want to add them in:
https://www.metlink.org.nz/api/v1/StopSearch/[STOP] https://www.metlink.org.nz/api/v1/StopsNearby/[LAT]/[LONG] https://www.metlink.org.nz/api/v1/Stop/[STOP] https://www.metlink.org.nz/api/v1/Service/[SERVICE]