{"metadata":{"image":[],"title":"","description":""},"api":{"url":"/highways/:state_id","auth":"required","results":{"codes":[{"language":"json","code":"{\n \"state\": {\n \"id\": 1,\n \"short_name\": \"AL\",\n \"long_name\": \"Alabama\"\n },\n \"highway_in_states\": [\n {\n \"id\": 21,\n \"highway\": {\n \"id\": 13,\n \"display_name\": \"I-10\",\n \"sign_name\": \"10\",\n \"sign_web_background_image\": \"interstate-bg.svg\",\n \"sign_background_image_small\": \"interstatesign_small.png\",\n \"sign_background_image_large\": \"interstatesign_large.png\",\n \"sign_text_color\": \"#FFFFFF\",\n \"highway_sign_class\": \"interstate-bg\",\n \"highway_type_id\": 1,\n \"highway_type\": \"Interstate\",\n \"positive_direction\": \"East\",\n \"negative_direction\": \"West\",\n \"direction_suffix\": \"bound\"\n }\n },\n {\n \"id\": 337,\n \"highway\": {\n \"id\": 168,\n \"display_name\": \"I-165\",\n \"sign_name\": \"165\",\n \"sign_web_background_image\": \"interstate-bg.svg\",\n \"sign_background_image_small\": \"interstatesign_small.png\",\n \"sign_background_image_large\": \"interstatesign_large.png\",\n \"sign_text_color\": \"#FFFFFF\",\n \"highway_sign_class\": \"interstate-bg\",\n \"highway_type_id\": 1,\n \"highway_type\": \"Interstate\",\n \"positive_direction\": \"North\",\n \"negative_direction\": \"South\",\n \"direction_suffix\": \"bound\"\n }\n } ...\n ]\n}","name":"","status":200}]},"settings":"","examples":{"codes":[{"language":"text","code":""}]},"method":"get","params":[{"name":"state_id","type":"int","default":"","desc":"[State](doc:state) `id`","required":false,"in":"path","ref":"","_id":"560d75fc1ec45619006069eb"}]},"next":{"description":"","pages":[]},"title":"Highways in State","type":"endpoint","slug":"highways-in-state","excerpt":"Get all the highways that pass through a particular state.","body":"** JSON Response **\n[block:parameters]\n{\n \"data\": {\n \"h-0\": \"Key\",\n \"h-1\": \"Value\",\n \"h-2\": \"Description\",\n \"0-0\": \"`state`\",\n \"0-1\": \"[State](doc:state)\",\n \"0-2\": \"The [State](doc:state) defined by the query parameter ID\",\n \"1-0\": \"`highway_in_states`\",\n \"1-1\": \"Array of [Highway In State](doc:highway-in-state)s\",\n \"1-2\": \"An array of [Highway In State](doc:highway-in-state) objects\"\n },\n \"cols\": 3,\n \"rows\": 2\n}\n[/block]\nThe first step of the Exit Lookup feature is to select a [State](doc:state). You do this with the [States API](doc:states). \n\nUpon choosing a [State](doc:state) (in the below case, Alabama), you can feed its `id` to this API and receive all [Highway](doc:highway)s that pass through this [State](doc:state). These results are called [Highway In State](doc:highway-in-state) objects.\n[block:image]\n{\n \"images\": [\n {\n \"image\": [\n \"https://files.readme.io/6PQyQqUyS2W51Idv3fEY_AlabamaHighways.png\",\n \"AlabamaHighways.png\",\n \"720\",\n \"1280\",\n \"#2db15e\",\n \"\"\n ],\n \"caption\": \"The Highways in State API in use inside the iExit Android app\"\n }\n ]\n}\n[/block]\nIt is important to know the difference between a [Highway](doc:highway) and a [Highway In State](doc:highway-in-state). A [Highway](doc:highway) defines a limited access road that **might** span multiple states. I-65, for instance, spans 4 states (Alabama, Tennessee, Kentucky, and Indiana), and thus there are 4 [Highway In State](doc:highway-in-state)s associated with the I-65 [Highway](doc:highway). \n\n** Common Next API(s) **\n- [Exits For Highway In State](doc:exits-for-highway-in-state) (read below)\n\nChoosing a `highway_in_state[]`.`id` is not enough to move on to the [Exits For Highway In State API](doc:exits-for-highway-in-state). We also need to select a direction for the chosen [Highway In State](doc:highway-in-state). \n[block:image]\n{\n \"images\": [\n {\n \"image\": [\n \"https://files.readme.io/Tf6d2XPTSI9RxVtLe0qG_AlabamaI65ChooseDirection.png\",\n \"AlabamaI65ChooseDirection.png\",\n \"720\",\n \"1280\",\n \"#53b6d1\",\n \"\"\n ],\n \"caption\": \"After selecting a highway, you should further prompt the user to select which direction on that highway they plan to travel.\"\n }\n ]\n}\n[/block]\nI-65, for instance, travels northbound and southbound, and each side is different, so a direction is required for the [Exits For Highway In State API](doc:exits-for-highway-in-state). This direction options come from the `string` values in `highway_in_state`.`highway`.`positive_direction` and `highway_in_state`.`highway`.`negative_direction`.\n[block:callout]\n{\n \"type\": \"warning\",\n \"title\": \"Note about \\\"positive\\\" and \\\"negative\\\" directions\",\n \"body\": \"We use the term \\\"positive\\\" and \\\"negative\\\" directions as cardinal-direction-agnostic terms for highway travel. For a North/South [Highway](doc:highway), North is the \\\"positive\\\" direction and \\\"South is the \\\"negative\\\" direction. For an East/West [Highway](doc:highway), East is \\\"positive\\\" and West is \\\"negative\\\".\"\n}\n[/block]","updates":[],"order":1,"isReference":false,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"560d74da772ec32d00fa5856","__v":1,"project":"560d5ac71ec45619006069d6","category":{"sync":{"isSync":false,"url":""},"pages":["5611758fb177ce190073d70a","56128cc85b4fb72300748549"],"title":"Data Hierarchy","slug":"data-hierarchy","order":1,"from_sync":false,"reference":false,"_id":"560dacb26660a03700976de4","createdAt":"2015-10-01T21:59:14.130Z","project":"560d5ac71ec45619006069d6","version":"560d5ac71ec45619006069d9","__v":2},"user":"560d5a4faf97231900938125","version":{"version":"1.0","version_clean":"1.0.0","codename":"","is_stable":true,"is_beta":false,"is_hidden":false,"is_deprecated":false,"categories":["560d5ac81ec45619006069da","560dabb698a6ae3700673f9f","560dabe1961d492300d94b4b","560dac2cd10a730d0081ac92","560dacb26660a03700976de4","560ebbffcac9dc0d007af87a"],"_id":"560d5ac71ec45619006069d9","releaseDate":"2015-10-01T16:09:43.711Z","__v":6,"createdAt":"2015-10-01T16:09:43.711Z","project":"560d5ac71ec45619006069d6"},"editedParams":true,"editedParams2":true,"githubsync":"","createdAt":"2015-10-01T18:00:58.533Z","parentDoc":null}
getHighways in State
Get all the highways that pass through a particular state.
Definition
{{ api_url }}{{ page_api_url }}
Parameters
Path Params
state_id:
integer
[State](doc:state) `id`