DotBahn.Timetables 1.4.0

dotnet add package DotBahn.Timetables --version 1.4.0
                    
NuGet\Install-Package DotBahn.Timetables -Version 1.4.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DotBahn.Timetables" Version="1.4.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DotBahn.Timetables" Version="1.4.0" />
                    
Directory.Packages.props
<PackageReference Include="DotBahn.Timetables" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add DotBahn.Timetables --version 1.4.0
                    
#r "nuget: DotBahn.Timetables, 1.4.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package DotBahn.Timetables@1.4.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=DotBahn.Timetables&version=1.4.0
                    
Install as a Cake Addin
#tool nuget:?package=DotBahn.Timetables&version=1.4.0
                    
Install as a Cake Tool

DotBahn - .NET Client for Deutsche Bahn APIs

NuGet NuGet NuGet

DotBahn is a collection of .NET client libraries for accessing Deutsche Bahn (DB) APIs. Query train schedules, station details, and facility status directly from your .NET applications.

Available clients:

  • StaDa: Station data including parking, accessibility, and opening hours.

  • FaSta: Real-time operational status of elevators and escalators at DB InfraGO AG stations.

  • Timetables: Scheduled departures and arrivals with real-time delay and platform change information.

This project originated from a personal application. Development follows my own needs rather than a fixed roadmap. Contributions and forks are welcome.

Table of Contents

Install

Install the packages you need from NuGet or GitHub Packages:

dotnet add package DotBahn.Timetables
dotnet add package DotBahn.Stations
dotnet add package DotBahn.Facilities

Usage

All packages integrate seamlessly with ServiceCollection.

// Add Stations/Timetables/Facilities clients
services.AddDotBahnStations(opt => {
    opt.ClientId = <your-client-id>;
    opt.ApiKey = <your-client-secret>;
    opt.BaseEndpoint = new Uri("...");
});

services.AddDotBahnTimetables(opt => {
    opt.BaseEndpoint = new Uri("...");
});

services.AddDotBahnFacilities(opt => {
    opt.BaseEndpoint = new Uri("...");
});

At least one client must include authorization credentials. Alternatively, configure authorization centrally:

// Add central authorization
services.AddDotBahnAuthorization(opt => {
    opt.ClientId = clientId;
    opt.ApiKey = clientSecret;
});

Enable request caching to reduce API calls:

// Add Cache
services.AddDotBahnCache(opt => {
    opt.DefaultExpiration = TimeSpan.FromSeconds(...); 
});

Manual Initialization

Create client instances directly without dependency injection:

var options = new ClientOptions {
    BaseEndpoint = new Uri("...")
};

var auth = new AuthorizationOptions {
    ClientId = <your-client-id>, 
    ApiKey = <your-client-secret>
};

var client = new StationsClient(opt, auth);

Authorization

A Deutsche Bahn API key is required. Register and obtain your credentials at the DB API Marketplace.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.