Find a file
Traines 4c8c503e48 version bump
[skip ci]
2025-01-14 22:36:03 +00:00
.github ci... 2025-01-08 17:54:07 +00:00
docs docs fixes 2025-01-14 22:35:19 +00:00
format stop() 2025-01-08 23:24:40 +00:00
lib cleanup 2025-01-11 21:14:50 +00:00
p db: support for polylines 2025-01-14 21:12:23 +00:00
parse support db regio-guide trip id/endpoint 2025-01-14 21:07:23 +00:00
test updat fixture for db poly endpoint 2025-01-14 22:24:53 +00:00
tools/debug-cli add back cli 2025-01-11 20:55:46 +00:00
.dockerignore fix docker build 2024-12-17 15:39:56 +00:00
.editorconfig Node 6+, cleanup 2016-12-14 00:22:02 +01:00
.eslintrc.json linting: add rules based on @stylistic/eslint-plugin 2024-02-10 16:49:38 +01:00
.gitignore fix docker build 2024-12-17 15:39:56 +00:00
api.js version bump 2025-01-10 18:59:32 +00:00
contributing.md contributing.md: link to testing docs 📝 2023-12-07 00:54:56 +01:00
Dockerfile fix dockerfile 2025-01-08 23:24:40 +00:00
index.js update docs 2025-01-14 22:16:09 +00:00
license.md readme: link to Travel-Status-DE-HAFAS 📝 2024-01-18 15:27:29 +01:00
package-lock.json version bump 2025-01-14 22:36:03 +00:00
package.json version bump 2025-01-14 22:36:03 +00:00
readme.md update docs 2025-01-14 22:16:09 +00:00
retry.js apply linting rules 2024-02-10 16:50:12 +01:00
throttle.js apply linting rules 2024-02-10 16:50:12 +01:00

db-vendo-client

A client for the new "vendo"/"movas" 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:

  • journeys(), refreshJourney() including tickets
  • locations(), nearby(),
  • departures(), arrivals() boards
  • trip()

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

  • journeys() details like scheduledDays, stop/station groups, some line details ...
  • loadFactor and other details in boards
  • certain stop details like products for locations() and geopositions and remarks for boards this can be remedied by turning on enrichStations in the config, enriching location info with db-hafas-stations.
  • some query options/filters (e.g. routingMode for journeys, direction for boards)
  • all other endpoints (tripsByName(), radar(), journeysFromTrip(), reachableFrom(), remarks(), lines(), station())

Depending on the configured profile, db-vendo-client will use multiple different DB APIs that offer varying functionality, so choose wisely:

db Profile dbnav Profile
no API key required
max duration boards 12h 1h
remarks not for boards (still no remarks() endpoint)
cancelled trips not contained in boards contained with cancelled flag
tickets only for refreshJourney(), mutually exclusive with polylines only for refreshJourney(), mutually exclusive with polylines
polylines only for refreshJourney() (mutually exclusive with tickets) and for trip() (only for HAFAS trip ids) only for refreshJourney()/trip(), mutually exclusive with tickets
trip ids used HAFAS trip ids for journeys, RIS trip ids for boards (static on train splits?) HAFAS trip ids
line.id/fahrtNr used unreliable/route id for journeys/trip(), actual fahrtNr for boards actual fahrtNr for journeys, unreliable/route id for boards and trip()
adminCode/operator adminCode only for boards only for journeys
stop()
assumed backend API stability less stable more stable

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

Also consult the documentation.

Background

After DB has switched to the new "vendo"/"movas" 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.

Actually, db-vendo-client is a wrapper around multiple different APIs, currently the bahn.de API for route planning and the regio-guide RIS API for boards for the db profile and the DB Navigator API for the dbnav profile. See some notes about the various new APIs at DB.

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

Usage

Use it as a dependency, e.g. just replacing hafas-client:

npm i db-vendo-client

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. The Dockerfile serves this API (using the dbnav profile):

docker run \
    -e USER_AGENT=my-awesome-program \
    -e DB_PROFILE=dbnav \
    -p 3000:3000 \
    ghcr.io/public-transport/db-vendo-client

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

  • 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.