derhuerst / vbb-rest

An HTTP API for Berlin & Brandenburg public transport.
https://v6.vbb.transport.rest/
ISC License
123 stars 14 forks source link

Some requests given as examples in the documentation don't work #53

Closed sophiamersmann closed 1 year ago

sophiamersmann commented 1 year ago

Hi :)

Some requests to https://v6.vbb.transport.rest that are given as examples in the documentation don't seem to work. For example, https://v6.vbb.transport.rest/stops/900000058101/departures?results=5 given in the Getting Started section (https://github.com/derhuerst/vbb-rest/blob/6/docs/getting-started.md#2-fetch-departures-at-a-stop) results in a Hafas error:

{
    "isHafasError": true,
    "code": "NOT_FOUND",
    "isCausedByServer": false,
    "hafasCode": "LOCATION",
    "url": "https://fahrinfo.vbb.de/bin/mgate.exe?",
    "hafasResponseId": "4k24wm4g6q469m4s",
    "hafasMessage": "HCI Service: location missing or invalid",
    "hafasDescription": "Während der Suche ist ein interner Fehler aufgetreten"
}

The same is true for other examples in the docs. For example, https://v6.vbb.transport.rest/journeys?from=900000023201&to.id=900980720&to.name=ATZE+Musiktheater&to.latitude=52.54333&to.longitude=13.35167 given as an example here returns the same Hafas error.

Using https://v5.vbb.transport.rest instead works though (at least for these two examples).

Thank you!

derhuerst commented 1 year ago

Back in the day, VBB used two different sets of stop/station IDs: the short ones (e.g. 900058101) in the HAFAS API, and the longer equivalents (e.g. 900000058101) in their static GTFS data. This is why the hafas-client@5 library used by v5.vbb.transport.rest automatically translated the short ones into the long ones, and vice versa.

Because VBB doesn't use the long IDs anymore (but IFOPT-based IDs called DHIDs, e.g. de:11000:900058101), I have removed this automatic translation in hafas-client@6, which v6.vbb.transport.rest uses.

Apparently, I have forgotten to adapt docs/getting-started.md while migrating to hafas-client@6.

The following places need to be adapted; You can usually just remove 000 after 9, but make sure to double-check if the resulting stop/station ID is actually valid. PR welcome!

https://github.com/derhuerst/vbb-rest/blob/fa0d6271803bc905cc18f74576cc32835431bf8d/docs/getting-started.md?plain=1#L21 https://github.com/derhuerst/vbb-rest/blob/fa0d6271803bc905cc18f74576cc32835431bf8d/docs/getting-started.md?plain=1#L37 https://github.com/derhuerst/vbb-rest/blob/fa0d6271803bc905cc18f74576cc32835431bf8d/docs/getting-started.md?plain=1#L48 https://github.com/derhuerst/vbb-rest/blob/fa0d6271803bc905cc18f74576cc32835431bf8d/docs/getting-started.md?plain=1#L51 https://github.com/derhuerst/vbb-rest/blob/fa0d6271803bc905cc18f74576cc32835431bf8d/docs/getting-started.md?plain=1#L76 https://github.com/derhuerst/vbb-rest/blob/fa0d6271803bc905cc18f74576cc32835431bf8d/docs/getting-started.md?plain=1#L124 https://github.com/derhuerst/vbb-rest/blob/fa0d6271803bc905cc18f74576cc32835431bf8d/docs/getting-started.md?plain=1#L127

sophiamersmann commented 1 year ago

Thanks for getting back to me so quickly and explaining this in such great detail! Happy to open a PR on Monday :)