Limiting returned results

Heya,

Is there a way to limit the amount of data returned? Say…the next 5 departures, or the next 2 hours or even just a mode that’s only arrival/departure time data.

I’m trying to use the Trip Planner API to build a mini departure board screen, except I’m hitting an issue with the size of the JSON its returning. I’m using a tiny ESP32 development board which has pretty limited memory and the JSON just straight up won’t fit into memory in its current form.

I’ve filtered down to a specific platform and filtered out everything I don’t want with exclMOT, but as it still returns a full 24 hours of trips, upcoming trackwork information in HTML and accessibility info for each station, I don’t think I’m ever gonna get it to fit.

1 Like

I’m assuming you’re referring to the Trip Planner Departure Monitor https://api.transport.nsw.gov.au/v1/tp/departure_mon API?

If you exclude the departureMonitorMacro=true attribute, you can specify a limit using limit=5 instead.

departureMonitorMacro=true sets a bunch of defaults which override any parameters you try to give it :slight_smile:

2 Likes

Ahah, that’s it, perfect. Thanks!

© Transport for NSW