trains/stream

Follow trains departures and arrivals live, in any station.

This is the documentation for version 1.0.0 of the API. Last update on Apr 30, 2020.

This API is provided under license Apache 2.0.

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

Trains

Be informed of all train departures

SUBSCRIBE trains/departures

Train has left a station

Attributes of a train leaving a station.

Payload
  • event string

    Type of the event.

    Values are left and arrived.

  • sent_at string(date-time)
  • train_code string

    Train's code.

  • train_passengers_count integer

    Current number of passengers in the train.

  • station_code string

    Station's code.

  • station_name string

    Station's full name.

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

Inform of a train departure

PUBLISH trains/departures

Train has left a station

Attributes of a train leaving a station.

Payload
  • event string

    Type of the event.

    Values are left and arrived.

  • sent_at string(date-time)
  • train_code string

    Train's code.

  • train_passengers_count integer

    Current number of passengers in the train.

  • station_code string

    Station's code.

  • station_name string

    Station's full name.

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

Be informed of all train departures

SUBSCRIBE trains/arrivals

Train has arrived in a station

Attributes of a train arriving in a station.

Payload
  • event string

    Type of the event.

    Values are left and arrived.

  • sent_at string(date-time)
  • train_code string

    Train's code.

  • train_passengers_count integer

    Current number of passengers in the train.

  • station_code string

    Station's code.

  • station_name string

    Station's full name.

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

Inform of a train arrival

PUBLISH trains/arrivals

Train has arrived in a station

Attributes of a train arriving in a station.

Payload
  • event string

    Type of the event.

    Values are left and arrived.

  • sent_at string(date-time)
  • train_code string

    Train's code.

  • train_passengers_count integer

    Current number of passengers in the train.

  • station_code string

    Station's code.

  • station_name string

    Station's full name.

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