Tramspotter API provides endpoints for serving Metrolink tram data to Tramspotter apps. It kinda acts as a Metrolink API proxy, as it provides data in a more readable JSON format.
This project is build with Deno. Make sure Deno is installed on your machine, if not you can always refer to installation manual.
Pull this repo to your local machine, and from its working directory you can run the dev server.
deno task dev
Here's a list of the routes available in Tramspotter API. Open endpoints require no authentication. All endpoints are rate-limited to 60 req/min.
GET /stations
Get a list of all available tram stops that operated by Manchester Metrolink network (TfGM) in a GeoJSON format.
Successful response will bear a HTTP Status Code of 200 OK
. Here's an example
of what a valid response may look like.
/stations
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [-2.26380062418, 53.38009116916]
},
"properties": {
"atcoCode": "9400ZZMAWYT2",
"naptanCode": "mantwjdt",
"name": "Wythenshawe Town Centre (Manchester Metrolink)",
"description": "Wythenshawe Town Centre Ainley Road"
}
}
]
}
The following HTTP errors may be encountered when using this endpoint:
- 405 Method Not Allowed
- 408 Request Time Out
- 500 Internal Server Error
- 503 Service Not Available
{
"success": false,
"errors": [
{
"status": 500,
"title": "Problem with parsing source XML dataset"
}
]
}
GET timetables/:id
Get an up-to-date timetable in JSON format for a given AtcoCode
supplied as
:id
.
Successful response will bear a HTTP Status Code of 200 OK
. Here's an example
of what a valid response may look like.
/timetables/9400ZZMATIM1
{
"arrivals": [
{
"carriages": "Double",
"destination": "Altrincham",
"status": "Due",
"wait": 1,
"id": "76297a62-2762-421f-ac22-c004ff707be3"
},
{
"carriages": "Single",
"destination": "Piccadilly",
"status": "Due",
"wait": 4,
"id": "bf66bd7d-7749-413e-b094-e755b39087a9"
}
],
"lastUpdated": "2023-03-07T17:19:01Z",
"line": "Altrincham",
"messageBoard": "On Thursday 9th March Manchester United welcome Real Betis to Old Trafford. Please allow extra time for travel",
"timestamp": 1678209547186
}
The following HTTP errors may be encountered when using this endpoint:
- 400 Bad Request
- 404 Not Found
- 405 Method Not Allowed
- 408 Request Time Out
- 500 Internal Server Error
- 503 Service Not Available
{
"success": false,
"errors": [
{
"status": 500,
"title": "Problem with parsing source XML dataset"
}
]
}