derhuerst / hafas-rest-api-client

An API client for hafas-rest-api endpoints.
https://github.com/derhuerst/hafas-rest-api-client
ISC License
6 stars 3 forks source link

Documentation for GET /journeys/legs/:ref wrong? #8

Closed pjattke closed 6 years ago

pjattke commented 6 years ago

The example of section GET /journeys/legs/:ref in the documentation states # this won't work, get a new ref from /journeys first. But I cannot see a ref in the received data of GET /journeys.

However, the GET /stations/:id/departures gives me a journeyID which looks quite similar to the expected ref string.

Is that just a mistake in the documentation or am I doing something wrong?

derhuerst commented 6 years ago

General explanation: vbb-rest just responds with the data returned by hafas-client. I didn't duplicate documentation about the response format because I would quickly forget to update the other if I changed one of them. This is why you currently need to read the hafas-client docs as well. I think that this is a suboptimal solution though.

Specific explanation: As mentioned in the docs for require('hafas-client').journeys(), each journey leg has an id field, which you can pass into /journeys/legs/:ref. It basically works like the docs for require('hafas-client').journeyLeg(ref).

derhuerst commented 6 years ago

please reopen if you still have a question regarding this.