Skip to content

Instantly share code, notes, and snippets.

@etexier
Last active August 29, 2015 14:05
Show Gist options
  • Save etexier/e67da389e8f397d8ed2c to your computer and use it in GitHub Desktop.
Save etexier/e67da389e8f397d8ed2c to your computer and use it in GitHub Desktop.
google distance rest-by-example
# This is a sample request that can be used as the Rest specification for a controller
# Be sure to precede request example with '# Request' and example response with '# Response'
+name getDistance
+Request
http://maps.googleapis.com/maps/api/distancematrix/json?origins=435+Tasso+Street+Palo+Alto+CA&destinations=Embarcadero+Street+San+Francisco+CA&sensor=false&mode=driving&language=en&units=imperial
# This is the expected response:
+Response
+Content-type application/json
+Body
{
"destination_addresses" : [ "Embarcadero, 298 Market Street, San Francisco, CA 94111, USA" ],
"origin_addresses" : [ "435 Tasso Street, Palo Alto, CA 94301, USA" ],
"rows" : [
{
"elements" : [
{
"distance" : {
"text" : "33.1 mi",
"value" : "53242"
},
"duration" : {
"text" : "42 mins",
"value" : "2512"
},
"status" : "OK"
}
]
}
],
"status" : "OK"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment