I’ve started using the /StopPoint/{id}/Arrivals
endpoint, which is very useful - but the docs are unclear which {id}
I actually need to use. I’ve experimented a bit and there seems to be different hierarchies for each mode that are inconsistent with one another.
For river buses, I just need to use to the Top-level id for the pier. For example, if I’m looking at https://api.tfl.gov.uk/StopPoint/930GWMR/ I can just add /Arrivals
and get the all the arrivals. This will get river buses in both directions in a single call, which I can then subdivide based on the platform
field if I wish.
Land buses are bit more complicated, for example adding /Arrivals
to https://api.tfl.gov.uk/StopPoint/490G00005736 just returns an empty array. Instead I need to trawl through the children of the StopPoint and then do separate calls for each direction of travel, as they have their own child StopPoints.
Tube stations get even more confusing, as they often have bus stops bundled with them. For example, for https://api.tfl.gov.uk/StopPoint/940GZZLUBMY I can add /Arrivals
, which will get me tube trains in both directions. But to get buses I have to look at the children of one of the children of the StopPoint and do separate /Arrivals
calls for each direction of travel.
So it seems that to get everything which stops at a StopPoint, I need to recursively go through all the children and then try /Arrivals
to see what comes back. The problem with this approach is I end up making a tonne of pointless calls like https://api.tfl.gov.uk/StopPoint/4900STFD3/Arrivals (Which I think is meant to be a list of arrivals to the Northern entrance of Stratford Station - it’s just an empty array)
Another option would be to use the lineGroup array - this seems to only include things I’m interested in (ie not doors and the like). My problem here is I don’t really understand the identifiers returned (naptanIdReference
vs stationAtcoCode
). I’ve done some experimenting and it seems like the logic is:
- Land buses:
/StopPoint/{naptanIdReference}/Arrivals
returns something useful;/StopPoint/{stationAtcoCode}/Arrivals
is an empty array. - River buses:
/StopPoint/{naptanIdReference}/Arrivals
is an empty array;/StopPoint/{stationAtcoCode}/Arrivals
returns something useful. - Tubes:
/StopPoint/{stationAtcoCode}/Arrivals
returns something useful;naptanIdReference
is missing.
This is quite frustrating because I can’t write mode-generic logic for lineGroups. (Also the lineGroups don’t tell you the mode, so I can’t even write mode-specific logic.)
Are there any docs that explain the StopPoint hierarchy in more detail and how that fits in with the Arrivals endpoints? Or even better, is there an endpoint that will show me the Arrivals for all vehicles arriving at a given StopPoint or any of its descendant StopPoints?
Cheers,
Luke