This project aims to make public access of SOFSE's Trains API, bypassing the security through obscurity of the internal API.
All the endpoints and params are the same of the original service, this is just a proxy that makes the authentication process available for public usage.
This was possible by scrapping the code inside the SOFSE Trains Android app,
Here's a blog post describing what was the process behind this.
The result of these queries can be piped to something like jq
for better formatting
Get all lines
curl 'https://ariedro.dev/api-trenes/lineas'
Get stations of line 5
curl 'https://ariedro.dev/api-trenes/estaciones/buscar?lineas=5'
Get the train schedules to go from "Drago" to "Miguelete"
curl 'https://ariedro.dev/api-trenes/estaciones/236/horarios?hasta=271'
Get the train schedules to go from "Drago" to "Miguelete", filtering only the arrival time
curl 'https://ariedro.dev/api-trenes/estaciones/236/horarios?hasta=271&fields=results%28desde%28llegada'
These are some of the endpoints that I've scrapped from the app, I don't know which of the parameters are required and how it works exactly, I'll probably complete more this documentation once I get to test it better.
Name | Located in | Type |
---|---|---|
id |
path | integer |
Name | Located in | Type |
---|---|---|
id |
path | integer |
hasta |
query | integer |
fields |
query | string |
lineas |
query | integer[] |
ramales |
query | integer[] |
cabeceraFinal |
query | integer[] |
servicio |
query | integer |
fecha |
query | string |
tipo |
query | string |
limit |
query | integer |
Name | Located in | Type |
---|---|---|
id |
path | integer |
fields |
query | string |
lineas |
query | integer[] |
Name | Located in | Type |
---|---|---|
lat |
query | double |
lon |
query | double |
radio |
query | integer |
limit |
query | integer |
lineas |
query | integer[] |
ramales |
query | integer[] |
exclude |
query | integer[] |
orderBy |
query | string |
fields |
query | string |
Name | Located in | Type |
---|---|---|
nombre |
query | string |
ids |
query | integer[] |
lineas |
query | integer[] |
ramales |
query | integer[] |
exclude |
query | integer[] |
limit |
query | integer |
orderBy |
query | string |
Name | Located in | Type |
---|---|---|
ids |
query | integer[] |
lineas |
query | integer[] |
limit |
query | integer |
fields |
query | string |
No parameters
Name | Located in | Type |
---|---|---|
desde |
query | integer |
hasta |
query | integer |
Name | Located in | Type |
---|---|---|
id |
path | integer |
token |
query | string |
Name | Located in | Type |
---|---|---|
id |
path | integer |
Just install and start
$ npm install
$ npm run start