Skip to content

Repository files navigation

🐌 SnailTime

Railtime.be API wrapper, written in Node

DEPRECATED: RailTime no longer exists, this repository only exists as an archive.

Available routes

RouteDescription
/API version information etc.
/statusThe status of the API and infrastructure
/disruptionsA list of all the train disruptions
/searchSearch for a station using a levenshtein lookup algorithm
/stationsA list of all the Belgian train stations
/stations/:idDetails of a particular station, includes train arrivals and departures
/stations/:id/arrivalsDetails of a particular station, arrivals only
/stations/:id/departuresDetails of a particular station, departures only
/routesRequest a route from Gent-Sint-Pieters to Antwerpen-Centraal

Localisation and i18n

The language you'd like to use is specified by supplying the Accept-Language header in your request as defined in RFC 2616.

List of languages that are accepted:

  • nl, fr, de, en

Alternatively:

  • nl-BE, fr-FR, de-DE, en-US, etc.

Any unrecognized language will default to English.

Id's vs strings

NOTE: If you are consuming this API in an automated way (through an application), we strongly suggest relying on Id's rather than strings because the Levenshtein distance algorithm used for string searching might return unexpected results.

A list of stations and their respective Id's can be found at /stations.

If you prefer using strings, the API supports supplying a string as the name of a station since v0.2.0.

If no matching station can be found, an exception is returned.

{error: {code: 404,message: "Could not find station: foobarbaz",type: "StationNotFoundException"}}

Searching

You can search for stations using the server (using a levenshtein lookup algorithm), useful for constraint devices (e.g. Spark, Electric Imp, Arduino, ...)

Params

NameDescriptionDetails 
qSearch queryThe name of the station you're searching for
example: "gent"
limitLimit results(optional) The maximum number of returned results, defaults to 5
example: 10

Note

When limit is set to 1 an object will be returned instead of an array.

Example

/search?q=gent

/search?q=gent&limit=10

Getting directions

Params

NameDescriptionDetails 
fromDeparture stationCould be an ID (int) or a name (string).
example: 455 or "gent-sint-pieters"
toArrival stationCould be an ID (int) or a name (string).
example: 455 or "gent-sint-pieters"
departureTime at which you wish to leaveformat: "YYYY-MM-dd HH:mm:ss"
example: "2014-12-14 08:00:00"
arrivalTime at which you wish to arriveformat: "YYYY-MM-dd HH:mm:ss"
example: "2014-12-14 08:00:00"

Example

/routes?from=455&to=37&departure=2014-12-14 08:00:00

or

/routes?from=gent-sint-pieters&to=antwerpen-centraal&departure=2014-12-14 08:00:00

About

🐌 SnailTime — A Railtime.be API wrapper

Resources

Stars

3 stars

Watchers

3 watching

Forks

Releases

Packages

Contributors

Languages