Status 300 (Multiple Choices) for Journey API

Journey API returns status 300 (Multiple Choices) for some queries between exisitng NaptaIds. Here are several samples. Looks like some stations like new New Cross and Upminster are affected.

Abbey Wood to New Cross: https://api.tfl.gov.uk/Journey/JourneyResults/910GABWDXR/to/910GNWCROSS?app_key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&date=20221013&time=1200"

Abbey Wood to Upminster: https://api.tfl.gov.uk/Journey/JourneyResults/910GABWDXR/to/910GUPMNSP6?app_key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&date=20221013&time=1200"

Acton Central to New Cross:
/Journey/JourneyResults/910GACTNCTL/to/910GNWCROSS?app_key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&date=20221013&time=1200

Acton to Upminster:
/Journey/JourneyResults/910GACTONML/to/910GUPMNSP6?app_key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&date=20221013&time=1200

Acton to Willesden Junction LL:
/Journey/JourneyResults/910GACTONML/to/910GWLSDNJL?app_key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&date=20221013&time=1200

Is there a reason not using 910GABWD and 940GZZLUUPM rather than these platform-specific locations

Iā€™m getting NaptanIds from the Stoppoint API.

  1. Abbey Wood
    910GABWDXR is NaptanId for ā€œAbbey Woodā€ on ā€œelizabeth-lineā€:

image

910GABWD is 910GABWD ā€œAbbey Wood (London) Rail Stationā€ on ā€œnational-railā€:

[Canā€™t add more than one screenshot as a Iā€™m a new user]

  1. Upminster

ā€œ910GUPMNSP6ā€ is ā€œUpminster Rail Stationā€ without any lines/modes - how can it be possible?

image

Thereā€™s another ā€œUpminster Rail Stationā€ with ā€œ910GUPMNSTRā€ and lines (ā€œnational-railā€,ā€œovergroundā€)

[Canā€™t add more than 1 screenshot as Iā€™m a new user]

Is it bad data or should I distinguish them somehow?

And ā€œ940GZZLUUPMā€ is ā€œUpminster Underground Stationā€ on ā€œtubeā€

@Ilya If thereā€™s a ā€œhubā€ Naptan code, itā€™s always better to use that!

Also, the Journey Planner can be used with comma separated lat,lon too.

Could you explain a little of what you are trying to achieve with your grid?

Apologies for a late reply - I was away

Both ā€œUpminster Rail Stationsā€ (910GUPMNSP6 & 910GUPMNSTR) from above have hubNaptanCode (same HUBUPM)

The 910GUPMNSP6 doesnā€™t have any lines info, modes, properties or children so I think I should use the other one I believe.

However, why two of them exist? Iā€™ve noticed that even location differs slightly:
ā€œlonā€: 0.250884 vs ā€œlonā€: 0.25088

ā€œUpminster stationā€ is actually THREE stations. The C2C line, the District Line and the London Overground line. The lines are not totally not connected: the Overground is connected to the rest of the rail network at Romford, and the District line isnā€™t connected to the National Rail network (mainly because the Underground uses third-rail DC current and the C2C line is overhead AC power, both with different signalling systems).

image

Hey, Iā€™m getting the same 300 status when trying to do a journey between two post codes.

Here are some examples:

https://api.tfl.gov.uk/journey/journeyresults/SE156BG/to/WC1X8AL
https://api.tfl.gov.uk/journey/journeyresults/e139gg/to/WC1X8AL

Any idea whatā€™s going on or how I can handle this?

@Toofy Welcome

I think you need to ensure you have valid postcodes before you call the API:

https://api.tfl.gov.uk/Journey/JourneyResults/E20%201BT/to/w1a%201aa

You can validate the ā€œinnerā€ part using the PAF: Iā€™m donā€™t think that there that there is a west-central 1X.

Hey @briantist thanks for your reply.

There most definitely is a WC1X, but you put me on the right track. The ā€˜fromā€™ parts have incorrect inner post codes, so I guess I will handle this as an error.

Maybe 300 potentially isnā€™t the right status code to respond with though? :wink:

1 Like

Itā€™s not by decision! I personally find that TfL has the most logical and helpful error codes of all the public APIs I use. Ever tried voi https://api.voiapp.io/ ? :roll_eyes:

I personally find that all the Microsoft-based ā€œ$typeā€ things in the TfL output somewhat redundant, but otherwise itā€™s almost wholly consistent and logical.

SE15 6BG, WC1X 8AL and E13 9GG are all valid postcodes, according to https://www.royalmail.com/find-a-postcode

I think perhaps TFLā€™s API is overdue for having its postcode database updated.

1 Like

WC1X 8AL has existed since 1980, a quick Google search revealed and appears to be a genuine area rather than a business-specific one. I suspect.that TfL has updated itā€™s postcode list at least once since 1980!

1 Like

Hi, any ideas why:

ā€œhttps://api.tfl.gov.uk/journey/journeyresults/51.509128,-0.196104/to/51.5092006,-0.1974416?app_id=xxxxxx&app_key=xxxxxx&mode=walkingā€

would have returned walking distance 6 months ago but is now returning a 300 (Multiple Choices) error? Both sets of coordinates are in London.

Welcome @thomaskenny

modes is always plural even if you only have one.

https://api.tfl.gov.uk/journey/journeyresults/51.509128,-0.196104/to/51.5092006,-0.1974416?modes=walking

1 Like