Request

origin: New York, NY destination: Boston, MA waypoints: optimize:true|Providence, RI|Hartford, CT mode: driving key: API_KEY

URL

https://maps.googleapis.com/maps/api/directions/json?origin=New+York,+NY&destination=Boston,+MA&waypoints=optimize:true|Providence,+RI|Hartford,+CT&key=YOUR_API_KEY
XML

Response

<?xml version="1.0" encoding="UTF-8"?> <DirectionsResponse> <status>OK</status> <route> <summary>I-95 N and CT-15 N</summary> <leg> <step> <travel_mode>DRIVING</travel_mode> <start_location> <lat>40.7126526</lat> <lng>-74.0065973</lng> </start_location> <end_location> <lat>40.7130849</lat> <lng>-74.0072188</lng> </end_location> <polyline> <points>aunwFflubMy@fB[R</points> </polyline> <duration> <value>9</value> <text>1 min</text> </duration> <html_instructions>Head <b>northwest</b> on <b>Steve Flanders Square</b> toward <b>Broadway</b>/<b>Canyon of Heroes</b><div style="font-size:0.9em">Restricted usage road</div></html_instructions> <distance> <value>73</value> <text>240 ft</text> </distance> </step> <step> <travel_mode>DRIVING</travel_mode> <start_location> <lat>40.7130849</lat> <lng>-74.0072188</lng> </start_location> <end_location> <lat>40.7114005</lat> <lng>-74.0086398</lng> </end_location> <polyline> <points>wwnwFbpubMdBtARN|AhAvBjB</points> </polyline> <duration> <value>96</value> <text>2 mins</text> </duration> <html_instructions>Turn <b>left</b> onto <b>Broadway</b></html_instructions> <distance> <value>222</value> <text>0.1 mi</text> </distance> <maneuver>turn-left</maneuver> </step> <step> <travel_mode>DRIVING</travel_mode> <start_location> <lat>40.7114005</lat> <lng>-74.0086398</lng> </start_location> <end_location> <lat>40.7119752</lat> <lng>-74.0058488</lng> </end_location> <polyline> <points>gmnwF~xubMDc@@G?GAGAOOaAm@}Da@cCMq@Ik@</points> </polyline> <duration> <value>54</value> <text>1 min</text> </duration> <html_instructions>Turn <b>left</b> onto <b>Park Row</b></html_instructions> <distance> <value>246</value> <text>0.2 mi</text> </distance> <maneuver>turn-left</maneuver> </step> <step> <travel_mode>DRIVING</travel_mode> <start_location> <lat>40.7119752</lat> <lng>-74.0058488</lng> </start_location> <end_location> <lat>40.7094901</lat> <lng>-74.0016720</lng> </end_location> <polyline> <points>{pnwFpgubM@K@CE{@?CAK?E?I@I@M?A@C@GBG@CVa@JKNWZi@Zi@\k@x@wAR_@HKn@}@p@aAbD{E</points> </polyline> <duration> <value>112</value> <text>2 mins</text> </duration> <html_instructions>Slight <b>right</b> onto <b>Frankfort St</b></html_instructions> <distance> <value>463</value> <text>0.3 mi</text> </distance> <maneuver>turn-slight-right</maneuver> </step> <step> <travel_mode>DRIVING</travel_mode> <start_location> <lat>40.7094901</lat> <lng>-74.0016720</lng> </start_location> <end_location> <lat>40.7095586</lat> <lng>-74.0015825</lng> </end_location> <polyline> <points>ianwFlmtbMMQ</points> </polyline> <duration> <value>25</value> <text>1 min</text> </duration> <html_instructions>Turn <b>left</b> onto <b>Pearl St</b></html_instructions> <distance> <value>11</value> <text>36 ft</text> </distance> <maneuver>turn-left</maneuver> </step> <step> <travel_mode>DRIVING</travel_mode> <start_location> <lat>40.7095586</lat> <lng>-74.0015825</lng> </start_location> <end_location> <lat>40.7093020</lat> <lng>-73.9941819</lng> </end_location> <polyline> <points>wanwFzltbM ...points truncated in this example</points> </polyline> <duration> <value>60</value> <text>1 min</text> </duration> <html_instructions>Take the <b>FDR Drive N</b> ramp</html_instructions> <distance> <value>746</value> <text>0.5 mi</text> </distance> </step> <step> <travel_mode>DRIVING</travel_mode> <start_location> <lat>40.7093020</lat> <lng>-73.9941819</lng> </start_location> <end_location> <lat>40.7973977</lat> <lng>-73.9291616</lng> </end_location> <polyline> <points>c`nwFr~rbMCi@ ...points truncated in this example</points> </polyline> <duration> <value>744</value> <text>12 mins</text> </duration> <html_instructions>Merge onto <b>FDR Drive</b></html_instructions> <distance> <value>12429</value> <text>7.7 mi</text> </distance> <maneuver>merge</maneuver> </step> <step> <travel_mode>DRIVING</travel_mode> <start_location> <lat>40.7973977</lat> <lng>-73.9291616</lng> </start_location> <end_location> <lat>40.8009073</lat> <lng>-73.9292939</lng> </end_location> <polyline> <points>wf_xFfhfbM}@ ...points truncated in this example</points> </polyline> <duration> <value>45</value> <text>1 min</text> </duration> <html_instructions>Take exit <b>17</b> on the <b>left</b> for <b>Toll Bridge</b> toward <b>I-278</b>/<b>Bruckner Expy</b>/<b>Grand Central Pkwy</b><div style="font-size:0.9em">Toll road</div></html_instructions> <distance> <value>679</value> <text>0.4 mi</text> </distance> <maneuver>ramp-left</maneuver> </step> <step> <travel_mode>DRIVING</travel_mode> <start_location> <lat>40.8009073</lat> <lng>-73.9292939</lng> </start_location> <end_location> <lat>40.7977328</lat> <lng>-73.9224261</lng> </end_location> <polyline> <points>u|_xF`ifbMnEkNh@ ...points truncated in this example</points> </polyline> <duration> <value>66</value> <text>1 min</text> </duration> <html_instructions>Continue onto <b>New York State Reference Rte 900G</b>/<b>Robert F. Kennedy Bridge</b><div style="font-size:0.9em">Partial toll road</div></html_instructions> <distance> <value>679</value> <text>0.4 mi</text> </distance> </step> <step> <travel_mode>DRIVING</travel_mode> <start_location> <lat>40.7977328</lat> <lng>-73.9224261</lng> </start_location> <end_location> <lat>40.7978505</lat> <lng>-73.9196151</lng> </end_location> <polyline> <points>yh_xFd~dbMPo@ ...points truncated in this example</points> </polyline> <duration> <value>38</value> <text>1 min</text> </duration> <html_instructions>Take the <b>Interstate 278 E</b> exit on the <b>left</b> toward <b>Bronx</b>/<b>New England</b>/<b>Interstate 87 N</b>/<b>Upstate N Y</b></html_instructions> <distance> <value>480</value> <text>0.3 mi</text> </distance> <maneuver>ramp-left</maneuver> </step> <step> <travel_mode>DRIVING</travel_mode> <start_location> <lat>40.7978505</lat> <lng>-73.9196151</lng> </start_location> <end_location> <lat>40.8017480</lat> <lng>-73.9167993</lng> </end_location> <polyline> <points>qi_xFrldbMAAIGA?_@WsBwAa@Wi@]i@]sCkBsCkBKGIGUOKGKGe@[g@[[S]Q</points> </polyline> <duration> <value>32</value> <text>1 min</text> </duration> <html_instructions>Merge onto <b>I-278 E</b><div style="font-size:0.9em">Partial toll road</div></html_instructions> <distance> <value>494</value> <text>0.3 mi</text> </distance> <maneuver>merge</maneuver> </step> ... Additional results truncated in this example[] ... <copyrights>Map data ©2015 Google</copyrights> <overview_polyline> <points>aunwFflubMdCuCl@ ...points truncated in this example</points> </overview_polyline> <waypoint_index>1</waypoint_index> <waypoint_index>0</waypoint_index> <bounds> <southwest> <lat>40.7087115</lat> <lng>-74.0065973</lng> </southwest> <northeast> <lat>42.3610870</lat> <lng>-71.0206956</lng> </northeast> </bounds> </route> <geocoded_waypoint> <geocoder_status>OK</geocoder_status> <type>locality</type> <type>political</type> <place_id>ChIJOwg_06VPwokRYv534QaPC8g</place_id> </geocoded_waypoint> <geocoded_waypoint> <geocoder_status>OK</geocoder_status> <type>locality</type> <type>political</type> <place_id>ChIJpVER8hFT5okRmVl96ahKjsw</place_id> </geocoded_waypoint> <geocoded_waypoint> <geocoder_status>OK</geocoder_status> <type>locality</type> <type>political</type> <place_id>ChIJXXN-Q-BE5IkRJ7azSE1832k</place_id> </geocoded_waypoint> <geocoded_waypoint> <geocoder_status>OK</geocoder_status> <type>locality</type> <type>political</type> <place_id>ChIJGzE9DS1l44kRoOhiASS_fHg</place_id> </geocoded_waypoint> </DirectionsResponse>
JSON

Response

{ "geocoded_waypoints" : [ { "geocoder_status" : "OK", "place_id" : "ChIJOwg_06VPwokRYv534QaPC8g", "types" : [ "locality", "political" ] }, { "geocoder_status" : "OK", "place_id" : "ChIJpVER8hFT5okRmVl96ahKjsw", "types" : [ "locality", "political" ] }, { "geocoder_status" : "OK", "place_id" : "ChIJXXN-Q-BE5IkRJ7azSE1832k", "types" : [ "locality", "political" ] }, { "geocoder_status" : "OK", "place_id" : "ChIJGzE9DS1l44kRoOhiASS_fHg", "types" : [ "locality", "political" ] } ], "routes" : [ { "bounds" : { "northeast" : { "lat" : 42.361087, "lng" : -71.0206956 }, "southwest" : { "lat" : 40.7087115, "lng" : -74.0065973 } }, "copyrights" : "Map data ©2015 Google", "legs" : [ { "distance" : { "text" : "117 mi", "value" : 188034 }, "duration" : { "text" : "2 hours 12 mins", "value" : 7897 }, "end_address" : "Hartford, CT, USA", "end_location" : { "lat" : 41.7637157, "lng" : -72.6852925 }, "start_address" : "New York, NY, USA", "start_location" : { "lat" : 40.71265260000001, "lng" : -74.0065973 }, "steps" : [ { "distance" : { "text" : "240 ft", "value" : 73 }, "duration" : { "text" : "1 min", "value" : 9 }, "end_location" : { "lat" : 40.7130849, "lng" : -74.00721879999999 }, "html_instructions" : "Head \u003cb\u003enorthwest\u003c/b\u003e on \u003cb\u003eSteve Flanders Square\u003c/b\u003e toward \u003cb\u003eBroadway\u003c/b\u003e/\u003cb\u003eCanyon of Heroes\u003c/b\u003e\u003cdiv style=\"font-size:0.9em\"\u003eRestricted usage road\u003c/div\u003e", "polyline" : { "points" : "aunwFflubMy@fB[R" }, "start_location" : { "lat" : 40.71265260000001, "lng" : -74.0065973 }, "travel_mode" : "DRIVING" }, { "distance" : { "text" : "0.1 mi", "value" : 222 }, "duration" : { "text" : "2 mins", "value" : 96 }, "end_location" : { "lat" : 40.7114005, "lng" : -74.0086398 }, "html_instructions" : "Turn \u003cb\u003eleft\u003c/b\u003e onto \u003cb\u003eBroadway\u003c/b\u003e", "maneuver" : "turn-left", "polyline" : { "points" : "wwnwFbpubMdBtARN|AhAvBjB" }, "start_location" : { "lat" : 40.7130849, "lng" : -74.00721879999999 }, "travel_mode" : "DRIVING" }, { "distance" : { "text" : "0.2 mi", "value" : 246 }, "duration" : { "text" : "1 min", "value" : 54 }, "end_location" : { "lat" : 40.7119752, "lng" : -74.0058488 }, "html_instructions" : "Turn \u003cb\u003eleft\u003c/b\u003e onto \u003cb\u003ePark Row\u003c/b\u003e", "maneuver" : "turn-left", "polyline" : { "points" : "gmnwF~xubMDc@@G?GAGAOOaAm@}Da@cCMq@Ik@" }, "start_location" : { "lat" : 40.7114005, "lng" : -74.0086398 }, "travel_mode" : "DRIVING" }, { "distance" : { "text" : "0.3 mi", "value" : 463 }, "duration" : { "text" : "2 mins", "value" : 112 }, "end_location" : { "lat" : 40.7094901, "lng" : -74.001672 }, "html_instructions" : "Slight \u003cb\u003eright\u003c/b\u003e onto \u003cb\u003eFrankfort St\u003c/b\u003e", "maneuver" : "turn-slight-right", "polyline" : { "points" : "{pnwFpgubM@K@CE{@ ...points truncated in this example" }, "start_location" : { "lat" : 40.7119752, "lng" : -74.0058488 }, "travel_mode" : "DRIVING" }, { "distance" : { "text" : "36 ft", "value" : 11 }, "duration" : { "text" : "1 min", "value" : 25 }, "end_location" : { "lat" : 40.7095586, "lng" : -74.0015825 }, "html_instructions" : "Turn \u003cb\u003eleft\u003c/b\u003e onto \u003cb\u003ePearl St\u003c/b\u003e", "maneuver" : "turn-left", "polyline" : { "points" : "ianwFlmtbMMQ" }, "start_location" : { "lat" : 40.7094901, "lng" : -74.001672 }, "travel_mode" : "DRIVING" }, { "distance" : { "text" : "0.5 mi", "value" : 746 }, "duration" : { "text" : "1 min", "value" : 60 }, "end_location" : { "lat" : 40.709302, "lng" : -73.9941819 }, "html_instructions" : "Take the \u003cb\u003eFDR Drive N\u003c/b\u003e ramp", "polyline" : { "points" : "wanwFzltbMCS ...points truncated in this example" }, "start_location" : { "lat" : 40.7095586, "lng" : -74.0015825 }, "travel_mode" : "DRIVING" }, ... Additional results truncated in this example[] ... ], "via_waypoint" : [] }, { "distance" : { "text" : "87.3 mi", "value" : 140570 }, "duration" : { "text" : "1 hour 33 mins", "value" : 5603 }, "end_address" : "Providence, RI, USA", "end_location" : { "lat" : 41.8238542, "lng" : -71.412656 }, "start_address" : "Hartford, CT, USA", "start_location" : { "lat" : 41.7637157, "lng" : -72.6852925 }, "steps" : [ { "distance" : { "text" : "164 ft", "value" : 50 }, "duration" : { "text" : "1 min", "value" : 11 }, "end_location" : { "lat" : 41.7641617, "lng" : -72.6852741 }, "html_instructions" : "Head \u003cb\u003enorth\u003c/b\u003e on \u003cb\u003eHungerford St\u003c/b\u003e toward \u003cb\u003eMichael J Fallon Way\u003c/b\u003e", "polyline" : { "points" : "g~{}F`jszLa@?u@C" }, "start_location" : { "lat" : 41.7637157, "lng" : -72.6852925 }, "travel_mode" : "DRIVING" }, { "distance" : { "text" : "364 ft", "value" : 111 }, "duration" : { "text" : "1 min", "value" : 26 }, "end_location" : { "lat" : 41.7642071, "lng" : -72.68661609999999 }, "html_instructions" : "Turn \u003cb\u003eleft\u003c/b\u003e onto \u003cb\u003eMichael J Fallon Way\u003c/b\u003e", "maneuver" : "turn-left", "polyline" : { "points" : "_a|}F|iszL?@CrBEvC" }, "start_location" : { "lat" : 41.7641617, "lng" : -72.6852741 }, "travel_mode" : "DRIVING" }, { "distance" : { "text" : "0.1 mi", "value" : 219 }, "duration" : { "text" : "1 min", "value" : 32 }, "end_location" : { "lat" : 41.7661707, "lng" : -72.68643109999999 }, "html_instructions" : "Turn \u003cb\u003eright\u003c/b\u003e onto \u003cb\u003eBroad St\u003c/b\u003e", "maneuver" : "turn-right", "polyline" : { "points" : "ia|}FjrszL_GUg@Ci@Cu@G" }, "start_location" : { "lat" : 41.7642071, "lng" : -72.68661609999999 }, "travel_mode" : "DRIVING" }, ... Additional results truncated in this example[] ... ], "via_waypoint" : [] }, { "distance" : { "text" : "50.2 mi", "value" : 80771 }, "duration" : { "text" : "59 mins", "value" : 3519 }, "end_address" : "Boston, MA, USA", "end_location" : { "lat" : 42.359824, "lng" : -71.05981249999999 }, "start_address" : "Providence, RI, USA", "start_location" : { "lat" : 41.8238542, "lng" : -71.412656 }, "steps" : [ { "distance" : { "text" : "98 ft", "value" : 30 }, "duration" : { "text" : "1 min", "value" : 10 }, "end_location" : { "lat" : 41.8236618, "lng" : -71.41291819999999 }, "html_instructions" : "Head \u003cb\u003esouthwest\u003c/b\u003e on \u003cb\u003eFulton St\u003c/b\u003e toward \u003cb\u003eEddy St\u003c/b\u003e", "polyline" : { "points" : "avg~FbxzrLd@r@" }, "start_location" : { "lat" : 41.8238542, "lng" : -71.412656 }, "travel_mode" : "DRIVING" }, { "distance" : { "text" : "249 ft", "value" : 76 }, "duration" : { "text" : "1 min", "value" : 36 }, "end_location" : { "lat" : 41.8231424, "lng" : -71.4123232 }, "html_instructions" : "Turn \u003cb\u003eleft\u003c/b\u003e onto \u003cb\u003eEddy St\u003c/b\u003e", "maneuver" : "turn-left", "polyline" : { "points" : "{tg~FvyzrLr@y@r@}@" }, "start_location" : { "lat" : 41.8236618, "lng" : -71.41291819999999 }, "travel_mode" : "DRIVING" }, ... Additional results truncated in this example[] ... ], "via_waypoint" : [] } ], "overview_polyline" : { "points" : "aunwFflubMd ...points truncated in this example" }, "summary" : "I-95 N and CT-15 N", "warnings" : [], "waypoint_order" : [ 1, 0 ] } ], "status" : "OK" }