Why do so many api calls fail?

I’m wondering if this is something that just affects me, or whether everyone has the same problem. During the last week a lot of my ‘Line’ and ‘StopPoint’ API calls seem to fail for no reason.
I know the calls works okay because they have returned data perfectly okay in the past, but now over half the calls are coming up as failed in my report.
I’ve got caching set up for everything, so I know i’m not making too many calls too quickly - I understand that I can do a maximum of 500 calls a minute and the most I’m doing at peak periods is about 90 (but it’s usually no more than 50-60).

One thing I have noticed is that if I make a call which fails, and I immediately refresh it, then it will invariably work - even though it’s exactly the same call.

Any help will be appreciated!


A few possible issues:

  • if you don’t use your app_key= the callls will work, but there will me a smaller limit of less than 500 calls;
  • if you are developing for more than one app, make sure you use different app_key= for each so you can see what’s happening with your usage for each one;
  • unless you really, really can’t, cache the calls you make in your own memcached cache. Unless you totally need to know which two stations a tube train is between right now the data returned from the API is designed to last for a while (in the http header) so use that no go no-where near the 500-a-minute limit;
  • Use the per-service calls (“where are all central line trains”) rather than highly filtered ones (“arrivals at Leyton”) and share the results from the cache. The simpler calls are more robust and you can serve many concurrent users at once this way;
  • It’s much easier to get the WHOLE DAMN TIMETABLE once a week with an single call - https://tfl.gov.uk/tfl/syndication/feeds/journey-planner-timetables.zip - than to overrun the rest of the API to get small bits of the timetable.
  • There’s always going to be issues with any form of edge-caching, so getting 500s and retrying is always going to happen…