db-vendo-client/readme.md
2024-12-07 23:59:04 +00:00

3.2 KiB
Raw Blame History

db-vendo-client

A client for the new "vendo" bahn.de APIs, a drop-in replacement for hafas-client.

ISC-licensed support Jannis via GitHub Sponsors

This is a very early version. What works:

  • rudimentary /journeys including lowest prices
  • /locations, /locations/nearby
  • /departures, /arrivals (requires a DB API Key for RIS::Boards, maybe you find one somewhere ;)

What doesn't work (yet, see TODO's scattered around the code):

  • /journeys details like scheduledDays, stop/station groups, tickets, some line details ...
  • /journeys uses different tripIds compared to departure and arrival boards...
  • certain stop details like products for /locations and geopositions for departures and arrivals
  • some query options like BahnCards etc.
  • all other endpoints

Feel free report anything that you stumble upon via Issues or create a PR :)

Also consult the relevant documentation of hafas-client (but beware of the limited functionality of db-vendo-client).

Background

After DB has switched to the new "vendo" platform for bahn.de and DB Navigator, the old HAFAS API (see hafas-client) seems to become less and less reliable (server unreachable, missing prices, etc.) This project aims to enable easy switching to the new APIs. However, not all information will be available from the new APIs.

Strictly speaking, permission is necessary to use this library with the bahn.de APIs.

Usage

See an example in api.js. It shows how you can use db-vendo-client together with hafas-rest-api in order to run a FPTF API server.

There are community-maintained TypeScript typings available as @types/hafas-client.

For the /departures and /arrivals endpoints, DB_API_KEY and DB_CLIENT_ID environment variables for RIS::Boards have to be set.

  • hafas-client including further related projects
  • hafas-rest-api expose a hafas-client or db-vendo-client instance as a REST API
  • db-rest for the legacy DB HAFAS endpoint
  • *.transport.rest  Public APIs wrapping some HAFAS endpoints.

Contributing

If you have a question, found a bug or want to propose a feature, please open an Issue.

This project needs help! Check the list of "help wanted" Issues.

If you're contributing code, please read the contribution guidelines.