diff --git a/docs/db-apis.md b/docs/db-apis.md index 24b342c1..678ca0ae 100644 --- a/docs/db-apis.md +++ b/docs/db-apis.md @@ -46,7 +46,7 @@ Notes: * loadFactor for some regional services, not for long distance services * boards up to 12 hours -## Vendo Navigator API +## Vendo/Movas Navigator API https://app.vendo.noncd.db.de/mob/ EPs: @@ -56,7 +56,7 @@ EPs: * angebote/fahrplan (for route planning) * zuglauf * zuglaeufe/ICE_947/halte/by-abfahrt/8000207_2024 (coach sequence) -* angebote/recon/autonomereservierung (prices) +* angebote/recon (tickets) Notes: * see [traffic dumps](dumps/) @@ -67,7 +67,7 @@ Notes: * does not contain machine-readable cancelled info in the boards (only "Halt entfällt" string), but contains relevant remarks * loadFactor only on journeys (?) -## Vendo bahn.de API +## Vendo/Movas bahn.de API https://int.bahn.de/web/api/ EPs: @@ -76,10 +76,11 @@ EPs: * reiseloesung/orte/nearby * reiseloesung/verbindung * reiseloesung/fahrt +* reiseloesung/abfahrten?datum=2024-12-30&zeit=11:55:00&ortExtId=8011160&ortId=A%3D1%40O%3DBerlin+Hbf%40X%3D13369549%40Y%3D52525589%40U%3D80%40L%3D8011160%40i%3DU%C3%97008065969%40&mitVias=true&maxVias=8&verkehrsmittel[]=ICE&verkehrsmittel[]=EC_IC&verkehrsmittel[]=IR&verkehrsmittel[]=REGIONAL +* reiseloesung/ankuenfte Notes: * no API Key needed * uses HAFAS trip IDs * provides loadFactor -* no boards (?) * polylines only for /verbindung and /fahrt \ No newline at end of file diff --git a/p/db/journeys-req.js b/p/db/journeys-req.js index 453646e2..9b0fa122 100644 --- a/p/db/journeys-req.js +++ b/p/db/journeys-req.js @@ -41,7 +41,7 @@ const formatJourneysReq = (ctx, from, to, when, outFrwd, journeysRef) => { method: 'post', }; }; - +// TODO poly conditional other endpoint const formatRefreshJourneyReq = (ctx, refreshToken) => { const {profile} = ctx; let query = { diff --git a/readme.md b/readme.md index df3a1300..305b0e5e 100644 --- a/readme.md +++ b/readme.md @@ -1,13 +1,13 @@ # db-vendo-client -**A client for the new "vendo" bahn.de APIs, a drop-in replacement for [hafas-client](https://github.com/public-transport/hafas-client/).** +**A client for the new "vendo"/"movas" bahn.de APIs, a drop-in replacement for [hafas-client](https://github.com/public-transport/hafas-client/).** ![ISC-licensed](https://img.shields.io/github/license/public-transport/db-vendo-client.svg) [![support Jannis via GitHub Sponsors](https://img.shields.io/badge/support%20Jannis-donate-fa7664.svg)](https://github.com/sponsors/derhuerst) This is a very early version. What works: -* `journeys()`, `refreshJourney()` including prices +* `journeys()`, `refreshJourney()` including tickets * `locations()`, `nearby()` * `departures()`, `arrivals()` boards * `trip()` @@ -15,12 +15,24 @@ This is a very early version. What works: What doesn't work (yet, see TODO's scattered around the code): * `journeys()` details like scheduledDays, stop/station groups, some line details ... -* `journeys()` uses different tripIds compared to departure and arrival boards... -* certain stop details like products for `locations()` and geopositions and remarks for boards -* some query options/filters (e.g. direction for boards) -* polylines only in `trips()` +* 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 options, enriching location info with [db-hafas-stations](https://github.com/derhuerst/db-hafas-stations). +* some query options/filters (e.g. routingMode for journeys, direction for boards) * all other endpoints (`tripsByName()`, `radar()`, `journeysFromTrip()`, `reachableFrom()`, `remarks()`, `lines()`, `stop()`, `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 | ✅ | +| cancelled trips | not contained in boards | contained with cancelled flag | +| tickets | only for `refreshJourney()` | only for `refreshJourney()`, mutually exclusive with polylines | +| polylines | only for `trip()` | only for `refreshJourney()/trip()`, mutually exclusive with tickets | +| trip ids used | HAFAS trip ids for journeys, RIS trip ids for boards | HAFAS trip ids | +| 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 relevant **[documentation](https://github.com/public-transport/hafas-client/blob/main/docs/readme.md)** of [hafas-client](https://github.com/public-transport/hafas-client/) (but beware of the limited functionality of db-vendo-client). @@ -28,9 +40,9 @@ Also consult the relevant **[documentation](https://github.com/public-transport/ ## Background -After DB has switched to the new "vendo" platform for bahn.de and DB Navigator, the old [HAFAS](https://de.wikipedia.org/wiki/HAFAS) API (see [hafas-client](https://github.com/public-transport/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. +After DB has switched to the new "vendo"/"movas" platform for bahn.de and DB Navigator, the old [HAFAS](https://de.wikipedia.org/wiki/HAFAS) API (see [hafas-client](https://github.com/public-transport/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. See some [notes about the various new APIs at DB](docs/db-apis.md). +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](docs/db-apis.md). Strictly speaking, permission is necessary to use this library with the DB APIs.