{"_id":"5499646c0195cc0b00dc32fb","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"},"githubsync":"","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":18,"project":"54995cb59da9390b00cffac6","metadata":{"title":"","description":"","image":[]},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2014-12-23T12:47:40.961Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":false,"order":3,"body":"The `journeys` endpoint gives you information on every journey made by a bus or tram service. Each journey contains the departure times at each stop on the journey. This information is similar to the `timetables` endpoint, but pivoted to show individual journeys over a range of stops, rather than a list of departures from one stop.\n\nAll 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\nThis endpoint is useful for applications such as producing calling points or displaying upcoming stops on a journey. Please be aware that high-frequency services such as bus services 22, 26 and 44 return results over 2Mb in size.\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/journeys/{service_name}\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\": \"`service_name`\",\n    \"0-1\": \"string\",\n    \"0-2\": \"Name of the bus or tram service (Edinburgh Trams is T50)\"\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    \\\"service_name\\\": \\\"1\\\",\\n    \\\"journeys\\\": [\\n        {\\n            \\\"direction\\\": \\\"East\\\",\\n            \\\"destination\\\": \\\"Easter Road (foot)\\\",\\n            \\\"day\\\": 0,\\n            \\\"note_id\\\": \\\"a\\\",\\n            \\\"valid_from\\\": 1414886400,\\n            \\\"departures\\\": [\\n                {\\n                    \\\"stop_id\\\": 36237636,\\n                    \\\"time\\\": \\\"4:21\\\",\\n                    \\\"timing_point\\\": true\\n                },\\n                {\\n                    \\\"stop_id\\\": 36237632,\\n                    \\\"time\\\": \\\"4:22\\\",\\n                    \\\"timing_point\\\": false\\n                },\\n                {\\n                    \\\"stop_id\\\": 36237626,\\n                    \\\"time\\\": \\\"4:23\\\",\\n                    \\\"timing_point\\\": false\\n                },\\n                ...\\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\": \"`direction`\",\n    \"0-1\": \"string\",\n    \"0-2\": \"The direction of the service - useful for filtering or information display\",\n    \"1-0\": \"`destination`\",\n    \"1-1\": \"string\",\n    \"2-0\": \"`day`\",\n    \"3-0\": \"`note_id`\",\n    \"4-0\": \"`valid_from`\",\n    \"5-0\": \"`stop_id`\",\n    \"6-0\": \"`time`\",\n    \"7-0\": \"`timing_point`\",\n    \"2-1\": \"int\",\n    \"3-1\": \"string\",\n    \"4-1\": \"int\",\n    \"5-1\": \"int\",\n    \"6-1\": \"string\",\n    \"7-1\": \"boolean\",\n    \"1-2\": \"The destination displayed on the vehicle's destination board during this journey\",\n    \"2-2\": \"The day(s) this journey operates (`0` for Mon-Fri, `5` for Saturday, `6` for Sunday)\",\n    \"3-2\": \"The `note` ID for this departure time\",\n    \"4-2\": \"The journey is valid from this date - please note this journey may be superseded with a journey from a forthcoming timetable\",\n    \"5-2\": \"The stop's SMS code\",\n    \"6-2\": \"The departure time in **H:MM**\",\n    \"7-2\": \"Whether this departure is considered a [timing point](http://en.wikipedia.org/wiki/Timing_point)\"\n  },\n  \"cols\": 3,\n  \"rows\": 8\n}\n[/block]","excerpt":"","slug":"journeys","type":"basic","title":"Journeys"}
The `journeys` endpoint gives you information on every journey made by a bus or tram service. Each journey contains the departure times at each stop on the journey. This information is similar to the `timetables` endpoint, but pivoted to show individual journeys over a range of stops, rather than a list of departures from one 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). This endpoint is useful for applications such as producing calling points or displaying upcoming stops on a journey. Please be aware that high-frequency services such as bus services 22, 26 and 44 return results over 2Mb in size. [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/journeys/{service_name} ## 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": "`service_name`", "0-1": "string", "0-2": "Name of the bus or tram service (Edinburgh Trams is T50)" }, "cols": 3, "rows": 1 } [/block] ## Response Status-Code: 200 OK [block:code] { "codes": [ { "code": "{\n \"service_name\": \"1\",\n \"journeys\": [\n {\n \"direction\": \"East\",\n \"destination\": \"Easter Road (foot)\",\n \"day\": 0,\n \"note_id\": \"a\",\n \"valid_from\": 1414886400,\n \"departures\": [\n {\n \"stop_id\": 36237636,\n \"time\": \"4:21\",\n \"timing_point\": true\n },\n {\n \"stop_id\": 36237632,\n \"time\": \"4:22\",\n \"timing_point\": false\n },\n {\n \"stop_id\": 36237626,\n \"time\": \"4:23\",\n \"timing_point\": false\n },\n ...\n ]\n }\n ]\n}", "language": "json" } ] } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Type", "h-2": "Description", "0-0": "`direction`", "0-1": "string", "0-2": "The direction of the service - useful for filtering or information display", "1-0": "`destination`", "1-1": "string", "2-0": "`day`", "3-0": "`note_id`", "4-0": "`valid_from`", "5-0": "`stop_id`", "6-0": "`time`", "7-0": "`timing_point`", "2-1": "int", "3-1": "string", "4-1": "int", "5-1": "int", "6-1": "string", "7-1": "boolean", "1-2": "The destination displayed on the vehicle's destination board during this journey", "2-2": "The day(s) this journey operates (`0` for Mon-Fri, `5` for Saturday, `6` for Sunday)", "3-2": "The `note` ID for this departure time", "4-2": "The journey is valid from this date - please note this journey may be superseded with a journey from a forthcoming timetable", "5-2": "The stop's SMS code", "6-2": "The departure time in **H:MM**", "7-2": "Whether this departure is considered a [timing point](http://en.wikipedia.org/wiki/Timing_point)" }, "cols": 3, "rows": 8 } [/block]