{"_id":"5499613c0195cc0b00dc32e7","githubsync":"","project":"54995cb59da9390b00cffac6","user":"54995c979da9390b00cffac5","category":{"_id":"5499610f0195cc0b00dc32e2","pages":["549961290195cc0b00dc32e3","549961320195cc0b00dc32e5","5499613c0195cc0b00dc32e7","549961499da9390b00cffad7","549961549da9390b00cffad9","5499615f9da9390b00cffadb","5499646c0195cc0b00dc32fb","549a60225b50c21400fae6b8","54cbbea561698d0d00baf85d"],"project":"54995cb59da9390b00cffac6","version":"54995cb59da9390b00cffac9","__v":9,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2014-12-23T12:33:19.815Z","from_sync":false,"order":9999,"slug":"api-reference","title":"API Reference"},"version":{"_id":"54995cb59da9390b00cffac9","__v":3,"project":"54995cb59da9390b00cffac6","createdAt":"2014-12-23T12:14:45.422Z","releaseDate":"2014-12-23T12:14:45.422Z","categories":["54995cb59da9390b00cffaca","54995e289da9390b00cffad0","5499610f0195cc0b00dc32e2"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"__v":14,"metadata":{"title":"","description":"","image":[]},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2014-12-23T12:34:04.990Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":false,"order":2,"body":"The `timetables` endpoint provides all departures from a specific stop. All departure times are shown in `H:MM` format - such as 4:32, 15:12 and 24:03. NightBus services are considered to start in the early morning, while day services can loop onto the next day (in this case, 24 is used for the hour instead of 0).\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Multiple timetables may be in effect\",\n  \"body\": \"Be aware that at certain times (up to several weeks before a service change) this endpoint may include more than one timetable - when this happens, each journey may be duplicated - one for the current timetable, one for the forthcoming timetable. Use the `valid_from` field to filter and sort journeys into separate tables.\"\n}\n[/block]\n## Resource\n\n    GET /v1/timetables/{stop_id}\n\n## Authorisation\n\nAPI Authentication Token\n\n## Update frequency\n\nOnce a day\n\n## Query Parameters\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"`stop_id`\",\n    \"0-1\": \"int\",\n    \"0-2\": \"The SMS code of the stop you want the timetable for\"\n  },\n  \"cols\": 3,\n  \"rows\": 1\n}\n[/block]\n## Response\n\n    Status-Code: 200 OK\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n    \\\"stop_id\\\": 36232897,\\n    \\\"stop_name\\\": \\\"Easter Road\\\",\\n    \\\"departures\\\": [\\n        {\\n            \\\"service_name\\\": \\\"1\\\",\\n            \\\"time\\\": \\\"5:01\\\",\\n            \\\"destination\\\": \\\"Easter Road\\\",\\n            \\\"day\\\": 0,\\n            \\\"note_id\\\": \\\"c\\\",\\n            \\\"valid_from\\\": 1414886400\\n        },\\n        {\\n            \\\"service_name\\\": \\\"35\\\",\\n            \\\"time\\\": \\\"5:10\\\",\\n            \\\"destination\\\": \\\"Ocean Terminal\\\",\\n            \\\"day\\\": 5,\\n            \\\"note_id\\\": null,\\n            \\\"valid_from\\\": 1414886400\\n        },\\n        {\\n            \\\"service_name\\\": \\\"1\\\",\\n            \\\"time\\\": \\\"5:31\\\",\\n            \\\"destination\\\": \\\"Easter Road\\\",\\n            \\\"day\\\": 6,\\n            \\\"note_id\\\": null,\\n            \\\"valid_from\\\": 1414886400\\n        },\\n        ...\\n    ]\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"`service_name`\",\n    \"1-0\": \"`time`\",\n    \"2-0\": \"`destination`\",\n    \"3-0\": \"`day`\",\n    \"4-0\": \"`note_id`\",\n    \"5-0\": \"`valid_from`\",\n    \"0-1\": \"string\",\n    \"1-1\": \"string\",\n    \"2-1\": \"string\",\n    \"3-1\": \"int\",\n    \"4-1\": \"string\",\n    \"5-1\": \"int\",\n    \"3-2\": \"The day(s) this departure operates. 1 is Mon-Fri, 5 is Saturday and 6 is Sunday.\",\n    \"0-2\": \"The service name of the departure (Edinburgh Trams is T50)\",\n    \"1-2\": \"The time of the departure in **H:MM**\",\n    \"2-2\": \"The destination displayed on the vehicle's destination board\",\n    \"5-2\": \"The time from which this departure is valid (can be superseded by newer timetables)\",\n    \"4-2\": \"The `note` ID for this departure time\"\n  },\n  \"cols\": 3,\n  \"rows\": 6\n}\n[/block]","excerpt":"","slug":"timetables","type":"basic","title":"Timetables"}
The `timetables` endpoint provides all departures from a specific stop. All departure times are shown in `H:MM` format - such as 4:32, 15:12 and 24:03. NightBus services are considered to start in the early morning, while day services can loop onto the next day (in this case, 24 is used for the hour instead of 0). [block:callout] { "type": "info", "title": "Multiple timetables may be in effect", "body": "Be aware that at certain times (up to several weeks before a service change) this endpoint may include more than one timetable - when this happens, each journey may be duplicated - one for the current timetable, one for the forthcoming timetable. Use the `valid_from` field to filter and sort journeys into separate tables." } [/block] ## Resource GET /v1/timetables/{stop_id} ## Authorisation API Authentication Token ## Update frequency Once a day ## Query Parameters [block:parameters] { "data": { "h-0": "Name", "h-1": "Type", "h-2": "Description", "0-0": "`stop_id`", "0-1": "int", "0-2": "The SMS code of the stop you want the timetable for" }, "cols": 3, "rows": 1 } [/block] ## Response Status-Code: 200 OK [block:code] { "codes": [ { "code": "{\n \"stop_id\": 36232897,\n \"stop_name\": \"Easter Road\",\n \"departures\": [\n {\n \"service_name\": \"1\",\n \"time\": \"5:01\",\n \"destination\": \"Easter Road\",\n \"day\": 0,\n \"note_id\": \"c\",\n \"valid_from\": 1414886400\n },\n {\n \"service_name\": \"35\",\n \"time\": \"5:10\",\n \"destination\": \"Ocean Terminal\",\n \"day\": 5,\n \"note_id\": null,\n \"valid_from\": 1414886400\n },\n {\n \"service_name\": \"1\",\n \"time\": \"5:31\",\n \"destination\": \"Easter Road\",\n \"day\": 6,\n \"note_id\": null,\n \"valid_from\": 1414886400\n },\n ...\n ]\n}", "language": "json" } ] } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Type", "h-2": "Description", "0-0": "`service_name`", "1-0": "`time`", "2-0": "`destination`", "3-0": "`day`", "4-0": "`note_id`", "5-0": "`valid_from`", "0-1": "string", "1-1": "string", "2-1": "string", "3-1": "int", "4-1": "string", "5-1": "int", "3-2": "The day(s) this departure operates. 1 is Mon-Fri, 5 is Saturday and 6 is Sunday.", "0-2": "The service name of the departure (Edinburgh Trams is T50)", "1-2": "The time of the departure in **H:MM**", "2-2": "The destination displayed on the vehicle's destination board", "5-2": "The time from which this departure is valid (can be superseded by newer timetables)", "4-2": "The `note` ID for this departure time" }, "cols": 3, "rows": 6 } [/block]