db-vendo-client/readme.md

55 lines
3.2 KiB
Markdown
Raw Normal View History

2024-12-07 16:16:31 +00:00
# db-vendo-client
2016-06-22 01:39:04 +02:00
2024-12-07 16:16:31 +00:00
**A client for the new "vendo" bahn.de APIs, a drop-in replacement for [hafas-client](https://github.com/public-transport/hafas-client/).**
2024-12-07 23:56:34 +00:00
![ISC-licensed](https://img.shields.io/github/license/public-transport/db-vendo-client.svg)
2020-04-18 17:15:46 +02:00
[![support Jannis via GitHub Sponsors](https://img.shields.io/badge/support%20Jannis-donate-fa7664.svg)](https://github.com/sponsors/derhuerst)
2016-06-22 01:39:04 +02:00
2024-12-07 16:16:31 +00:00
This is a very early version. What works:
2024-12-07 16:16:31 +00:00
* rudimentary `/journeys` including lowest prices
2024-12-07 23:48:17 +00:00
* `/locations`, `/locations/nearby`
* `/departures`, `/arrivals` (requires a DB API Key for RIS::Boards, maybe you find one somewhere ;)
2016-06-22 01:39:04 +02:00
2024-12-07 23:48:17 +00:00
What doesn't work (yet, see TODO's scattered around the code):
2024-12-07 23:48:17 +00:00
* `/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.
2024-12-07 16:16:31 +00:00
* all other endpoints
2017-11-13 00:38:09 +01:00
2024-12-07 23:48:17 +00:00
Feel free report anything that you stumble upon via Issues or create a PR :)
2024-12-07 23:56:34 +00:00
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).
2017-11-13 00:38:09 +01:00
2016-06-22 01:39:04 +02:00
2024-12-07 16:16:31 +00:00
## Background
2024-12-07 23:56:34 +00:00
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.
2024-12-07 16:16:31 +00:00
Strictly speaking, permission is necessary to use this library with the bahn.de APIs.
2016-06-22 01:39:04 +02:00
## Usage
2024-12-07 16:16:31 +00:00
See an example in [api.js](api.js). It shows how you can use `db-vendo-client` together with `hafas-rest-api` in order to run a [FPTF](https://github.com/public-transport/friendly-public-transport-format) API server.
2017-11-13 00:38:09 +01:00
2024-12-07 16:16:31 +00:00
There are [community-maintained TypeScript typings available as `@types/hafas-client`](https://www.npmjs.com/package/@types/hafas-client).
2024-12-07 23:48:17 +00:00
For the `/departures` and `/arrivals` endpoints, `DB_API_KEY` and `DB_CLIENT_ID` environment variables for RIS::Boards have to be set.
2019-12-10 19:39:17 +01:00
## Related Projects
2024-12-07 16:16:31 +00:00
- [hafas-client](https://github.com/public-transport/hafas-client/) including further related projects
2024-12-07 23:56:34 +00:00
- [hafas-rest-api](https://github.com/public-transport/hafas-rest-api/) expose a hafas-client or db-vendo-client instance as a REST API
2024-12-07 16:16:31 +00:00
- [db-rest](https://github.com/derhuerst/db-rest/) for the legacy DB HAFAS endpoint
- [`*.transport.rest`](https://transport.rest/)  Public APIs wrapping some HAFAS endpoints.
2016-06-22 01:39:04 +02:00
## Contributing
2024-12-07 23:56:34 +00:00
If you **have a question**, **found a bug** or want to **propose a feature**, please [open an Issue](https://github.com/public-transport/db-vendo-client/issues).
2020-03-18 21:32:05 +01:00
2024-12-07 23:56:34 +00:00
This project needs help! Check the [list of "help wanted" Issues](https://github.com/public-transport/db-vendo-client/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22).
If you're contributing code, please read the [contribution guidelines](contributing.md).