Created
March 7, 2013 13:17
-
-
Save palmerc/5107999 to your computer and use it in GitHub Desktop.
A proposed replacement for the Ruter API. Maybe a servlet could frontend the Ruter server to translate to a cleaner API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Ruter API Proposal ## | |
## Stops ## | |
stops - Return a list of all stops | |
stops/ID - Return information about a specific stop | |
stops/name - Return information about a specific stop | |
stops?filter=autocomplete/name - Return possible matching names and IDs | |
stops/ID/departures - Return realtime departures for a stop | |
stops/ID/arrivals - Return realtime arrivals for a stop | |
stops/ID/departures?filter=schedule - Return the scheduled times for the stop | |
A stop record | |
{ | |
"stop_id":3010090, | |
"name":"Bryggetorget", | |
"coordinates":{ "latitude":56.0, "longitude":10.0 }, | |
"lines":[ 1, 2, 3, 4, 5, 6 ], | |
"platforms":[...], | |
"fare_zone":1 | |
} | |
A departure record | |
{ | |
"trip_id":123456, | |
"platform_id":11, | |
"line_id":54, | |
"destination":"Timbuktu", | |
"departure_time":"2013-03-06T03:17:01.001+0100", | |
} | |
An arrival record | |
{ | |
"trip_id":123456, | |
"platform_id":11, | |
"line_id":54, | |
"destination":"Timbuktu", | |
"arrival_time":"2013-03-06T03:17:01.001+0100", | |
} | |
## Lines ## | |
lines - Return a list of all transit lines | |
lines/ID - Return information about a specific line | |
lines/ID/schedule - Return the schedule for the line | |
A line record | |
{ | |
"line_id":54, | |
"display_name":"54", | |
"transit_type":0 | |
"destinations":{ | |
"Kjelsås":[ | |
{ | |
"stops":[STOP1, STOP2, ..., STOPN] | |
} | |
], | |
"Aker Brygge":[ | |
{ | |
"stops":[STOP1, STOP2, ..., STOPN] | |
} | |
] | |
} | |
} | |
A schedule record | |
{ | |
"line_id":54, | |
"display_name":"54", | |
"transit_type":0, | |
"destinations":{ | |
"Kjelsås":[ | |
{ | |
"trip_id":1, | |
"operator":"Unibuss", | |
"vehicle_id":"101032", | |
"stops":[STOP1, STOP2, ..., STOPN], | |
"times":[TIME1, TIME2, ..., TIMEN] | |
}, | |
{ | |
"trip_id":2, | |
"operator":"Unibuss", | |
"vehicle_id":"101033", | |
"stops":[STOP1, STOP2, ..., STOPN], | |
"times":[TIME1, TIME2, ..., TIMEN] | |
}, | |
{ | |
"trip_id":3, | |
"operator":"Unibuss", | |
"vehicle_id":"101034", | |
"stops":[STOP1, STOP2, ..., STOPN], | |
"times":[TIME1, TIME2, ..., TIMEN] | |
} | |
], | |
"Aker Brygge":[ | |
{ | |
"trip_id":1, | |
"operator":"Unibuss", | |
"vehicle_id":"201032", | |
"stops":[STOP1, STOP2, ..., STOPN], | |
"times":[TIME1, TIME2, ..., TIMEN] | |
}, | |
{ | |
"trip_id":2, | |
"operator":"Unibuss", | |
"vehicle_id":"201033", | |
"stops":[STOP1, STOP2, ..., STOPN], | |
"times":[TIME1, TIME2, ..., TIMEN] | |
}, | |
{ | |
"trip_id":3, | |
"operator":"Unibuss", | |
"vehicle_id":"201034", | |
"stops":[STOP1, STOP2, ..., STOPN], | |
"times":[TIME1, TIME2, ..., TIMEN] | |
} | |
] | |
} | |
} | |
## Trips ## | |
trips - Return all trips | |
trips/ID - Return a specific trip | |
A trip record | |
{ | |
"trip_id":1, | |
"line_id":54 | |
"display_name":"Aker Brygge" | |
"operator":"Unibuss", | |
"vehicle_id":"201032", | |
"transit_type":0, | |
"stops":[STOP1, STOP2, ..., STOPN], | |
"times":[TIME1, TIME2, ..., TIMEN] | |
} | |
## Routes ## | |
routes?from={}&to={}&time={}&qualifier={} - Return possible routings | |
from/to - lat/long coordinate, address, station | |
time - ISO 8601 | |
qualifier - leave_before, leave_after, arrive_before, arrive_after | |
A route record | |
{ | |
"duration":"PT1123S", | |
"legs":{LEG1, LEG2, ..., LEGN} | |
} | |
A leg record | |
{ | |
"trip_id":1 | |
"from_stop_id":3010090, | |
"to_stop_id":3010100 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment