reedwade / metlink-api-maybe

Some code I've got working that uses an undocumented API found inside https://www.metlink.org.nz/
MIT License
49 stars 9 forks source link

Additional end points #2

Open simoncoggins opened 7 years ago

simoncoggins commented 7 years ago

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]

reedwade commented 7 years ago

nice! I'll have a play around with that.

thanks

jedforrest commented 6 years ago

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

dbfr3qs commented 6 years ago

@simoncoggins I'm getting a bad request with the StopsNearby endpoint, do you have a simple example using curl I could try?

simoncoggins commented 6 years ago

Looks like it's moved to StopNearby now (or I made a typo the first time):

https://www.metlink.org.nz/api/v1/StopNearby/-41.28/174.76

dbfr3qs commented 6 years ago

Thanks mate! 👍

dbfr3qs commented 6 years ago

Has anyone found anything that describes the complete route of a service?

simoncoggins commented 6 years ago

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.

dbfr3qs commented 6 years ago

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 🤷‍♂️

psyciknz commented 6 years ago

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.

zacps commented 6 years ago

More endpoints:

https://www.metlink.org.nz/api/v1/ServiceLocation/<service_code>
nzphoenix commented 6 years ago

@zacps - Don't use the mapdatajson endpoint, it's incomplete and will be removed soon.

Instead use /api/v1/ServiceMap/

zacps commented 6 years ago

@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.

nzphoenix commented 6 years ago

@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.

rawiriblundell commented 5 years ago

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:

https://fyi.org.nz/request/11057/response/40120/attach/3/Response%20to%20OIA%202019%20288%20Jack%20Hazlehurst.pdf

reedwade commented 5 years ago

cool! I really need to tidy this whole thing up

reedwade commented 5 years ago

I attend this recent talk which relates-- https://www.youtube.com/watch?v=Ier5BF952Y8