This projects provides a Swagger/OpenAPI specification for the Deutsche Bahn Fahrplan API:
Additionally, the project also provides a simple Java Client generated using Swagger Codegen and slightly customized.
Add the following dependency to your project:
<dependency>
<groupId>org.hisrc.db-fahrplan-api</groupId>
<artifactId>db-fahrplan-api-client</artifactId>
<version>...</version>
</dependency>
DbFahrplanApiClient client = new DefaultDbFahrplanApiClient(authKey);
List<StopLocation> stopLocations = client.locationName("Frankfurt Hbf");
List<DepartureOrArrival> arrivals = client.arrivalBoard("008000105", LocalDateTime.now());
List<DepartureOrArrival> departures = client.departureBoard("008000105", LocalDateTime.now());
List<DepartureOrArrival> arrivals = client.arrivalBoard("008000105", LocalDateTime.now());
JourneyDetailRef journeyDetailRef = arrivals.get(0).getJourneyDetailRef();
JourneyDetail journeyDetail = client.journeyDetail(journeyDetailRef);