StopPoint Search - How do I use the topMostParentId

Hi everyone,

Apologies for what may be a very stupid question, I am very new to APIs and the data that TFL publish so I’m happy to just be pointed to some documentation that I missed.

I spent a couple of hours over the last few days wrestling with this and wanted clarification on what data is being sent back and what I can do with it.

What I wanted to do was fairly straightforward - I just wanted to bring back the predicted arival time for a local bus stop, however for this I needed the StopPoint ID.

I found that you can get a list back by searcing on a common name using this:

[https://api.tfl.gov.uk/StopPoint/Search/Mayplace]

Which is great.

However neither the icsId: 1015380 or the topMostParentId: 490G00015380 is the StopPoint id that works in this API call:

StopPoint/{id}/Arrivals
(had to de-link as I’m a new poster)

It wasn’t until I tried the SMS code for the bus stop:

[https://api.tfl.gov.uk/StopPoint/Search/74861]

That I ended up getting back the bit of data labelled as id: which had the code that I needed: 490015380E

This then works in the arrivals call:

StopPoint/490015380E/Arrivals
(had to de-link as I’m a new poster)

Which labels that code as the naptanId.

So my question is, how would you get from the topMostParentID 490G00015380 from the StopPoint/Search call to what the naptanId is for the actual stop, that can be used in the Arrivals call?

Thanks in advance

Ian

Hi :@IanW

/StopPoint/topmostid

will return all the children, then lineGroup[] will show you which subsidiaries are associated with which lines. There is also more info on the individual stops and the hierarchy in children[]

3 Likes

Thanks @nickp that’s really helplful.

The bit that I hadn’t understood is that both bus stops on either side of the road (even though they aren’t that close) are referred to with the same name and that 490G00015380 references that pair. It makes a lot more sense now.

Ian