StopPoint Arrivals is out of date if I use my app key

Certain stops are returned old results from 26 December, but only if I use the app_id and app_key. Without that it returns live results. I’ve tried in a couple of browsers to check it’s not a local cacheing issue, and it matches the data my app is getting.

Here’s the url, I’ll remove the actual keys:
https://api.tfl.gov.uk/StopPoint/940GZZLUKSL/Arrivals?mode=tube&app_id=(removed)&app_key=(removed)

This returns

[
  {
    "$type": "Tfl.Api.Presentation.Entities.Prediction, Tfl.Api.Presentation.Entities",
    "id": "1059139851",
    "operationType": 1,
    "vehicleId": "222",
    "naptanId": "940GZZLUKSL",
    "stationName": "Kensal Green Underground Station",
    "lineId": "bakerloo",
    "lineName": "Bakerloo",
    "platformName": "Northbound - Platform 2",
    "direction": "outbound",
    "bearing": "",
    "destinationNaptanId": "940GZZLUHAW",
    "destinationName": "Harrow & Wealdstone Underground Station",
    "timestamp": "2020-12-26T10:28:48.1846152Z",
    "timeToStation": 1840,
    "currentLocation": "Between Elephant & Castle and Lambeth North",
    "towards": "Harrow and Wealdstone",
    "expectedArrival": "2020-12-26T10:59:28Z",
    "timeToLive": "2020-12-26T10:59:28Z",
    "modeName": "tube",
    "timing": {
      "$type": "Tfl.Api.Presentation.Entities.PredictionTiming, Tfl.Api.Presentation.Entities",
      "countdownServerAdjustment": "00:00:00",
      "source": "0001-01-01T00:00:00",
      "insert": "0001-01-01T00:00:00",
      "read": "2020-12-26T10:29:46.668Z",
      "sent": "2020-12-26T10:28:48Z",
      "received": "0001-01-01T00:00:00"
    }
  },
  {
    "$type": "Tfl.Api.Presentation.Entities.Prediction, Tfl.Api.Presentation.Entities",
    "id": "-2106697535",
    "operationType": 1,
    "vehicleId": "224",
    "naptanId": "940GZZLUKSL",
    "stationName": "Kensal Green Underground Station",
    "lineId": "bakerloo",
    "lineName": "Bakerloo",
    "platformName": "Northbound - Platform 2",
    "direction": "outbound",
    "bearing": "",
    "destinationNaptanId": "940GZZLUHAW",
    "destinationName": "Harrow & Wealdstone Underground Station",
    "timestamp": "2020-12-26T10:28:48.1846152Z",
    "timeToStation": 1420,
    "currentLocation": "Between Charing Cross and Piccadilly Circus",
    "towards": "Harrow and Wealdstone",
    "expectedArrival": "2020-12-26T10:52:28Z",
    "timeToLive": "2020-12-26T10:52:28Z",
    "modeName": "tube",
    "timing": {
      "$type": "Tfl.Api.Presentation.Entities.PredictionTiming, Tfl.Api.Presentation.Entities",
      "countdownServerAdjustment": "00:00:00",
      "source": "0001-01-01T00:00:00",
      "insert": "0001-01-01T00:00:00",
      "read": "2020-12-26T10:29:46.668Z",
      "sent": "2020-12-26T10:28:48Z",
      "received": "0001-01-01T00:00:00"
    }
  },
  {
    "$type": "Tfl.Api.Presentation.Entities.Prediction, Tfl.Api.Presentation.Entities",
    "id": "657977210",
    "operationType": 1,
    "vehicleId": "225",
    "naptanId": "940GZZLUKSL",
    "stationName": "Kensal Green Underground Station",
    "lineId": "bakerloo",
    "lineName": "Bakerloo",
    "platformName": "Southbound - Platform 1",
    "direction": "inbound",
    "bearing": "",
    "destinationNaptanId": "940GZZLUEAC",
    "destinationName": "Elephant & Castle Underground Station",
    "timestamp": "2020-12-26T10:28:48.1846152Z",
    "timeToStation": 58,
    "currentLocation": "At Platform",
    "towards": "Elephant and Castle",
    "expectedArrival": "2020-12-26T10:29:46Z",
    "timeToLive": "2020-12-26T10:29:46Z",
    "modeName": "tube",
    "timing": {
      "$type": "Tfl.Api.Presentation.Entities.PredictionTiming, Tfl.Api.Presentation.Entities",
      "countdownServerAdjustment": "00:00:00",
      "source": "0001-01-01T00:00:00",
      "insert": "0001-01-01T00:00:00",
      "read": "2020-12-26T10:29:46.668Z",
      "sent": "2020-12-26T10:28:48Z",
      "received": "0001-01-01T00:00:00"
    }
  },
  {
    "$type": "Tfl.Api.Presentation.Entities.Prediction, Tfl.Api.Presentation.Entities",
    "id": "-1705592170",
    "operationType": 1,
    "vehicleId": "231",
    "naptanId": "940GZZLUKSL",
    "stationName": "Kensal Green Underground Station",
    "lineId": "bakerloo",
    "lineName": "Bakerloo",
    "platformName": "Southbound - Platform 1",
    "direction": "inbound",
    "bearing": "",
    "destinationNaptanId": "940GZZLUEAC",
    "destinationName": "Elephant & Castle Underground Station",
    "timestamp": "2020-12-26T10:28:48.1846152Z",
    "timeToStation": 700,
    "currentLocation": "At Wembley Central Platform 2",
    "towards": "Elephant and Castle",
    "expectedArrival": "2020-12-26T10:40:28Z",
    "timeToLive": "2020-12-26T10:40:28Z",
    "modeName": "tube",
    "timing": {
      "$type": "Tfl.Api.Presentation.Entities.PredictionTiming, Tfl.Api.Presentation.Entities",
      "countdownServerAdjustment": "00:00:00",
      "source": "0001-01-01T00:00:00",
      "insert": "0001-01-01T00:00:00",
      "read": "2020-12-26T10:29:46.668Z",
      "sent": "2020-12-26T10:28:48Z",
      "received": "0001-01-01T00:00:00"
    }
  },
  {
    "$type": "Tfl.Api.Presentation.Entities.Prediction, Tfl.Api.Presentation.Entities",
    "id": "1552401836",
    "operationType": 1,
    "vehicleId": "233",
    "naptanId": "940GZZLUKSL",
    "stationName": "Kensal Green Underground Station",
    "lineId": "bakerloo",
    "lineName": "Bakerloo",
    "platformName": "Northbound - Platform 2",
    "direction": "outbound",
    "bearing": "",
    "destinationNaptanId": "940GZZLUHAW",
    "destinationName": "Harrow & Wealdstone Underground Station",
    "timestamp": "2020-12-26T10:28:48.1846152Z",
    "timeToStation": 880,
    "currentLocation": "At Edgware Road Platform 1",
    "towards": "Harrow and Wealdstone",
    "expectedArrival": "2020-12-26T10:43:28Z",
    "timeToLive": "2020-12-26T10:43:28Z",
    "modeName": "tube",
    "timing": {
      "$type": "Tfl.Api.Presentation.Entities.PredictionTiming, Tfl.Api.Presentation.Entities",
      "countdownServerAdjustment": "00:00:00",
      "source": "0001-01-01T00:00:00",
      "insert": "0001-01-01T00:00:00",
      "read": "2020-12-26T10:29:46.668Z",
      "sent": "2020-12-26T10:28:48Z",
      "received": "0001-01-01T00:00:00"
    }
  }
]

If I remove the keys, then I get live results. (As I write there are no trains on the Bakerloo line so its empty, but this worked earlier)
https://api.tfl.gov.uk/StopPoint/940GZZLUKSL/Arrivals?mode=tube

Is this a known issue? Is there a way to solve it?

Rob

If it’s caching problem then the thing to is to add an extra dummy parameter on the end, ie &dontcacheme=1234565

That’s a good idea. Yep, just adding &x on the end seems to fix this. So there’s some sort of server-side cache happening which isn’t updating.

But, is this a workaround, or should the content be updating without this? The results used to update reliably, it just seems to have stuck on Boxing Day, and I’d rather not do a workaround.

Of course it … should be … operating without this.

The problem we have here is that there can be “invisible” caches in various systems, from the Browser environment to a “cloud” cache at the server farm end.

When you make the https://api.tfl.gov.uk/StopPoint/940GZZLUKSL/Arrivals?mode=tube request, the response headers look like this will all the cache values set to “no-cache”

so you would expect this to instruct the caches between your code - via the framework, the Browser, the CDN - and the server to respect this header and not cache.

So, I would F12->Network (f5) first file->Headers->Request Headers and see if you get back the same cache headers using your app_id and app_key.

This looks like a good description of the issues - https://www.mnot.net/cache_docs/

The issue has resolved itself now.

I was getting the same results in two different environments (one at home and one in a cloud host), which would have pointed to a CDN or Varnish issue. But as it happens, it’s gone away now. Hopefully it won’t return. :crossed_fingers:

This happened to me last year too. Definitely a server-side caching issue that should be looked at.