trains/stream
1.0.0

Follow trains departures and arrivals live, in any station.

This is the documentation for version 1.0.0 of the API. Last update on Jan 10, 2023.

This API is provided under license Apache 2.0.

Protocol: mqtt
trains.mycompany.com:{port}

Authentication

Api key

Send an API key in the user field to authenticate with the API.


SUBSCRIBE trains/departures

Train has left a station

Attributes of a train leaving a station.

Payload

Payload example
{
  "event": "left",
  "sent_at": "2023-05-04T09:42:00+00:00",
  "train_code": "string",
  "train_passengers_count": 42,
  "station_code": "string",
  "station_name": "string"
}

Inform of a train departure

PUB trains/departures
PUBLISH trains/departures

Train has left a station

Attributes of a train leaving a station.

Payload

Payload example
{
  "event": "left",
  "sent_at": "2023-05-04T09:42:00+00:00",
  "train_code": "string",
  "train_passengers_count": 42,
  "station_code": "string",
  "station_name": "string"
}
SUBSCRIBE trains/arrivals

Train has arrived in a station

Attributes of a train arriving in a station.

Payload

Payload example
{
  "event": "left",
  "sent_at": "2023-05-04T09:42:00+00:00",
  "train_code": "string",
  "train_passengers_count": 42,
  "station_code": "string",
  "station_name": "string"
}

Inform of a train arrival

PUB trains/arrivals
PUBLISH trains/arrivals

Train has arrived in a station

Attributes of a train arriving in a station.

Payload

Payload example
{
  "event": "left",
  "sent_at": "2023-05-04T09:42:00+00:00",
  "train_code": "string",
  "train_passengers_count": 42,
  "station_code": "string",
  "station_name": "string"
}