Hello!
I’d like to suggest a feature request regarding the /Crowding API endpoints, to allow developers to get the crowding data for multiple stations within the same request.
Current behaviour
At the moment if I want to get the live crowding data for both the London Underground and Elizabeth line sections of Tottenham Court Road, this requires 2 separate requests:
api.tfl.gov.uk/crowding/940GZZLUTCR/Live
and
api.tfl.gov.uk/crowding/910GTOTCTRD/Live
And likewise for the average daily crowding, by omitting the “/Live” at the end.
What I think would be helpful is for the {Naptan} URL parameter to accept a comma-seperated list of IDs, just like with several other endpoints.
Examples in other API endpoints
Currently https://api.tfl.gov.uk/StopPoint/{ids}
accepts a comma-seperated list of station IDs, and https://api.tfl.gov.uk/Line/{ids}
accepts a comma-seperated list of line IDs.
So ideally, I would be able to call https://api.tfl.gov.uk/crowding/940GZZLUTCR,910GTOTCTRD/Live
and get back the crowding data for both stations at once. The saving isn’t much for just 2 stations together, but if I need data for 10+ stations at once, then it would save a significant number of API calls.
Alternative solution
I’ve noticed that the /StopPoint endpoint has an optional parameter “includeCrowdingData”, however setting this true does not return any additional data as far as I have seen.
After trying multiple different stations (including hubs), it seems to occasionally add a “passengerFlows” array when includeCrowdingData
is true, however this array is always empty.
If this could be resolved (and have a way of returning both average and live crowding), then this would also work as an option, as this endpoint already accepts a comma-separated list of stations.