0.0.2-beta • Published 11 years ago

nwbapi v0.0.2-beta

Weekly downloads
3
License
-
Repository
github
Last release
11 years ago

Nordwestbahn API

This is an API of the German traffic enterprise NordWestBahn based in Osnabrück. The NWB train lines in the north western of Germany. So, this API Description will be in German.

Das ist eine API der NordWestBahn aus Osnabrück. Die NWB betreibt Bahnlinien im nordwesten Deutschlands, diese Implementierung greif auf die Webseite der NWB zurück. Es besteht keine Verbindung mit der NordWestBahn.

API

Die API ist mit Promisses umgesetzt. Für Details, schaue bitte auf der GitHub-Seite des Projekte Q nach.

nwb.stationId(stationName)

Liefert ein Array mit Betriebsstellen zurück. Die Betriebsstellen-ID wird benötigt um eine Abfrage gegen die nwb.timetable(stationId) zu machen.

Beispiel:

nwb.stationId('Kleve')
.then( function (stationIds) {
  console.log(stationIds);
  /*
    logs: [ { id: 'KKLV', bezeichnung: 'Kleve' } ]
  */
});

nwb.timetable(stationId)

Liefert ein Array mit Abfahrten zurück. Die stationId kann mit nwb.stationId(stationName) geholt werden.

Beispiel:

nwb.timetable('KKLV')
.then( function (timetable) {
  console.log(timetable);
  /*
    logs: 
    [ { std: '22:19',
        etd: '',
        train: { id: '75077', line: 'RE10', name: 'Niers-Express' },
        direction: 'Düsseldorf Hbf',
        info: 'Keine Echtzeitinformationen vorhanden' } ]
})