Issues with arrival data on /Mode/{mode}/Arrivals

Hi there

I’m using the /Mode/{mode}/Arrivals endpoint to collect arrival times for all stops on both the dlr and tube (so I make one request for each mode). I set the ‘count’ variable to 10 to try and get the latest 10 results (or however many there are) for each station.

Sometimes when I get the data back, say 900 results for the tube, I find that all the expectedArrival timestamps are all within 2 or 3 seconds. The same is true of the corresponding timeToStation times.

I’ve noticed that these grouped predictions are usually predicted to arrive slightly in the past, within a minute of the time I made the query. I assume that this means they have already arrived.

But then often there aren’t any further predictions.

Sometimes I’ll get the arrival times spread out in a more expected way, i.e. over the next 10-20 minutes.

Sometimes I’ll get 1800 results, sometimes just 100, with calls made just minutes apart.

My request is formed like this:
https://api.tfl.gov.uk//mode/tube/arrivals?app_id=[appid]&app_key=[key]&count=10

Am I doing something wrong, are my expectations for this endpoint wrong, or is there something else going on?

Thanks!

Richard

Welcome @richardhawthorn

This is because the TfL system is caching the computed results for a minute, probably to stop people hammering the system.

Some part of the tube system don’t make predictions very well. The legacy systems that drive the tube lines can’t make predictions about trains that haven’t left their origin. This means that stations within a few stops of the line ends will only have “endwards” predictions, or perhaps one the other way.

There is a push system for the tube data, but it only works with SingalR on C# and Javascript.