Game API

From SimRail Wiki
Revision as of 23:53, 27 March 2023 by Roman (talk | contribs)
Jump to navigation Jump to search
API logo, source pngegg.com

Train Timetable API

This API retrieves train schedules for the train number specified by the driver.

Source:

Secret -for now-

https://staging.simrail.deadlykungfu.ninja/train/40684

Response

Will return an array of TrainTimetableRow

[
  {
    "train_number": "40684",
    "scheduled_arrival_hour": null,
    "station": "Tychy Lodowisko",
    "layover": null,
    "scheduled_departure_hour": "17:26",
    "train_type": "ROJ",
    "line": "179",
    "cachedate": "2023-02-12T18:48:23.975Z",
    "stop_type": "ph",
    "hourSort": 0
  },
  {
    "train_number": "40684",
    "scheduled_arrival_hour": "17:27",
    "station": "Tychy Miasto",
    "layover": "0.0",
    "scheduled_departure_hour": "17:27",
    "train_type": "ROJ",
    "line": "179",
    "cachedate": "2023-02-12T18:48:24.000Z",
    "stop_type": null,
    "hourSort": 1727
  }
]

TimeTableRow

Field Type Description
train_number string The number of the train
scheduled_arrival_hour string / null The time the train should arrive at the station
station string The station name
layover string / null Time in minutes of the layover if the train stops at this station
line string The line the train will be running at this station
cachedate string Time this data was updated for the last time
stop_type string / null If there is a stop at the station, the type of the layover. ph or pt
hourSort number Hour in HHmm format to help sorting the data or focus the current station

Dispatch station timetables

This API will return the timetable of the station post

Source: Official EDR

Parameters

One of the Post id: BZ LZ_LC SG_R52 are the only ones supported during staging

Request

https://staging.simrail.deadlykungfu.ninja/dispatch/BZ

Response

The response will be an Array of StationTimetableRow

/!\ The official EDR timetable has a bug where some departure times for trains differ of 1minute between dispatch and train data. This is not an API bug /!\

[
  {
    "train_number": "14141",
    "train_type": "ECE",
    "type_speed": 0,
    "stop_type": null,
    "platform": " ",
    "arrival_time": "00:00",
    "departure_time": "00:00",
    "from_post": "Dąbrowa Górnicza",
    "to_post": "Sosnowiec Główny",
    "line": "1",
    "start_station": "Warszawa Grochów",
    "terminus_station": "Bohumin",
    "cachedate": "2023-02-12T18:08:32.837Z",
    "hourSort": 0
  },
  {
    "train_number": "41144",
    "train_type": "ECE",
    "type_speed": 0,
    "stop_type": null,
    "platform": " ",
    "arrival_time": "00:05",
    "departure_time": "00:05",
    "from_post": "Sosnowiec Główny",
    "to_post": "Dąbrowa Górnicza",
    "line": "1",
    "start_station": "Bohumin Vrbice",
    "terminus_station": "Warszawa Grochów",
    "cachedate": "2023-02-12T18:08:32.859Z",
    "hourSort": 5
  }
]

StationTimetableRow

Content of each elements of the array:

Field Type Description
train_number string The number of the train
train_type string The type of the train
type_speed number / undefined The maximum speed for the train type, if we have such info
platform string The platform the train will stop. Example I 1
arrival_time string Scheduled arrival time of the train
departure_time string Scheduled departure time of the train
from_post string The station where the train comes from
to_post string The station where the train goes
line string The line the train needs to be sent to
start_station string The starting station of the train
terminus_station string The terminus station of the train
cachedate string The last time the data was updated from the source
hourSort ǹumber Internal sorting value, can also help to focus current row

Steam profiles

Returns the username and the avatarUrl of a given user without calling SimRail API and cached for a day

Request

https://staging.simrail.deadlykungfu.ninja/steam/<steam_id>

Response

An array containing one object with the data

[
  {
    "avatar": "https://avatars.akamai.steamstatic.com/70845eef7475441ffc0c9f9685cf40a57df07e15.jpg",
    "pseudo": "Someone"
  }
]

Train infos by server

n/a

Author: DeadlyKungFu.Ninja

Website: http://docs.simrail.deadlykungfu.ninja/