Closed michaelcheers closed 6 years ago
The underlying (HAFAS) VBB API either doesn't have the concept of a line ID or doesn't expose it. It only exposes this ref
, which you can use to query details about the trip (the individual vehicle travelling, not the line).
The fact that json[0].line.id
is there is only because the departures(stationId)
method returns data in the Friendly Public Transport Format 1.0.1
. I'm aware that this is misleading and should probably document this better.
This is a general problem: VBB provides open static data, which contains lines including their IDs. Except from very brittle matching by name, there is no way to associate a static line ID with a trip from the HAFAS API. This significantly reduces the number of use cases unfortunately.
Say I got this result from asking for the departures:
How would I get the line id? I would have though
json[0].line.id
would have done it but I just get the lowercase version of the name and not a valid id,