Game API: Difference between revisions

From SimRail Wiki
Jump to navigation Jump to search
No edit summary
Tag: Reverted
No edit summary
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[File:Api pngegg.png|thumb|300x300pixel|API logo, source pngegg.com]]
[[File:Api pngegg.png|thumb|300x300pixel|API logo, source pngegg.com]]{{notranslate}}
==API Horario del tren==
== Train Timetable API ==
Esta API recupera los horarios de los trenes correspondientes al número de tren especificado por el maquinista.
This API retrieves train schedules for the train number specified by the driver.
===Fuente===
===Source:===
De momento, secreta.
Secret -for now-
  https://staging.simrail.deadlykungfu.ninja/train/40684
  https://staging.simrail.deadlykungfu.ninja/train/40684
===Respuesta===
===Response===
Devolverá una matriz de la TrainTimetableRow (Fila)
Will return an array of TrainTimetableRow
  [
  [
   {
   {
Line 33: Line 33:
   }
   }
  ]
  ]
====Fila Horario====
====TimeTableRow====
{| class="wikitable"
{| class="wikitable"
!Campo
!Field
!Tipo
!Type
!Descripción
!Description
|-
|-
|Train number
|train_number
|<code>variable</code>
|<code>string</code>
|El número del tren
|The number of the train
|-
|-
|scheduled_arrival_hour
|scheduled_arrival_hour
|<code>variable / nulo</code>
|<code>string / null</code>
|La hora de llegada del tren a la estación
|The time the train should arrive at the station
|-
|-
|Station
|station
|<code>variable</code>
|<code>string</code>
|El nombre de la estación
|The station name
|-
|-
|Layover
|layover
|<code>variable / nulo</code>
|<code>string / null</code>
|Tiempo de la parada en minutos si el tren se detiene en esta estación.
|Time in minutes of the layover if the train stops at this station
|-
|-
|Line
|line
|<code>variable</code>
|<code>string</code>
|La ía por la que ese tren accederá a la estación.
|The line the train will be running at this station
|-
|-
|cachedate
|cachedate
|<code>variable</code>
|<code>string</code>
|Hora en la que se actualizaron estos datos por última vez.
|Time this data was updated for the last time
|-
|-
|stop_type
|stop_type
|<code>variable / nulo</code>
|<code>string / null</code>
|Si hay una parada en la estación, el tipo de escala. <code>ph</code> o <code>pt</code>
|If there is a stop at the station, the type of the layover. <code>ph</code> or <code>pt</code>
|-
|-
|hourSort
|hourSort
|<code>numérico</code>
|<code>number</code>
|Hora (en formato HHmm) para ayudar a ordenar los datos o centrarse en la estación actual.
|Hour in HHmm format to help sorting the data or focus the current station
|}
|}
==Horarios del puesto de Control==
==Dispatch station timetables==
Esta API recuperará el cuadro horario del puesto de Control.
This API will return the timetable of the station post


Fuente: EDR oficial
Source: Official EDR
===Parámetros===
===Parameters===
Uno de los identificadores de Puesto (Post id): <code>BZ</code> <code>LZ_LC</code> <code>SG_R52</code> son los únicos admitidos durante la recopilación
One of the Post id: <code>BZ</code> <code>LZ_LC</code> <code>SG_R52</code> are the only ones supported during staging
===Solicitud===
===Request===
  https://staging.simrail.deadlykungfu.ninja/dispatch/BZ
  https://staging.simrail.deadlykungfu.ninja/dispatch/BZ
===Respuesta===
===Response===
La respuesta será un ajuste de la fila StationTimetableRow
The response will be an Array of StationTimetableRow


''/!\ El cuadro horario del EDR oficial tiene un error según el cual algunos horarios de salida de los trenes difieren en 1 minuto entre el puesto de control y los datos del tren. Esto no supone un error de la API /!\.''
''/!\ 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 /!\''
  [
  [
   {
   {
Line 117: Line 117:
   }
   }
  ]
  ]
====Fila Horario de la estación====
====StationTimetableRow====
Contenido de cada elemento de la matriz:
Content of each elements of the array:
{| class="wikitable"
{| class="wikitable"
!Campo
!Field
!Tipe
!Type
!Descripción
!Description
|-
|-
|train_number
|train_number
|<code>variable</code>
|<code>string</code>
|El número del tren
|The number of the train
|-
|-
|train_type
|train_type
|<code>variable</code>
|<code>string</code>
|El tipo de tren
|The type of the train
|-
|-
|type_speed
|type_speed
|<code>numérico / indefinido</code>
|<code>number / undefined</code>
|La velocidad máxima para el tipo de tren (si disponemos de dicha información).
|The maximum speed for the train type, if we have such info
|-
|-
|platform
|platform
|<code>variable</code>
|<code>string</code>
|El andén en que se detendrá el tren, por ejemplo <code>I 1</code>
|The platform the train will stop. Example <code>I 1</code>
|-
|-
|arrival_time
|arrival_time
|<code>variable</code>
|<code>string</code>
|Hora de llegada prevista del tren.
|Scheduled arrival time of the train
|-
|-
|departure_time
|departure_time
|<code>variable</code>
|<code>string</code>
|Hora de salida del tren.
|Scheduled departure time of the train
|-
|-
|from_post
|from_post
|<code>variable</code>
|<code>string</code>
|Estación de procedencia del tren.
|The station where the train comes from
|-
|-
|to_post
|to_post
|<code>variable</code>
|<code>string</code>
|Estación hacia la que se dirige el tren.
|The station where the train goes
|-
|-
|line
|line
|<code>variable</code>
|<code>string</code>
|La vía por la que se debe enviar el tren.
|The line the train needs to be sent to
|-
|-
|start_station
|start_station
|<code>variable</code>
|<code>string</code>
|La estación origen del tren.
|The starting station of the train
|-
|-
|terminus_station
|terminus_station
|<code>variable</code>
|<code>string</code>
|La estación término del tren.
|The terminus station of the train
|-
|-
|cachedate
|cachedate
|<code>variable</code>
|<code>string</code>
|La última vez que se actualizaron los datos desde la fuente.
|The last time the data was updated from the source
|-
|-
|hourSort
|hourSort
|<code>numérico</code>
|<code>ǹumber</code>
|Valor de clasificación de carácter interno, que también puede ayudar a enfocar la fila actual.
|Internal sorting value, can also help to focus current row
|}
|}
==Perfiles de Steam (Steam profiles)==
==Steam profiles==
Devuelve el nombre de usuario y el avatarUrl de un usuario determinado sin llamar a la API de SimRail y la mantiene en caché durante un día.
Returns the username and the avatarUrl of a given user without calling SimRail API and cached for a day
===Solicitud===
===Request===
  [https://staging.simrail.deadlykungfu.ninja/steam/%3Csteam_id%3E https://staging.simrail.deadlykungfu.ninja/steam/<steam_id>]
  [https://staging.simrail.deadlykungfu.ninja/steam/%3Csteam_id%3E https://staging.simrail.deadlykungfu.ninja/steam/<steam_id>]
===Respuesta===
===Response===
Una matriz que contiene un elemento con sus datos.
An array containing one object with the data
  [
  [
   {
   {
Line 188: Line 188:
   }
   }
  ]
  ]
==Información del tren por el Servidor==
==Train infos by server==
n/a
n/a


''Autor: DeadlyKungFu.Ninja''
''Author: DeadlyKungFu.Ninja''


''Sitio Web: http://docs.simrail.deadlykungfu.ninja/''
''Website: http://docs.simrail.deadlykungfu.ninja/''

Latest revision as of 14:55, 17 April 2023

API logo, source pngegg.com

Ambox speedy deletion.png This is the source page. This page is not allowed for translation.

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/