, . , Google, , 14 2015 .
UrlFetchApp API. , , .
function directionsAPI(origin, destination) {
var Your_API_KEY = "Put Your API Key Here";
var serviceUrl = "https://maps.googleapis.com/maps/api/directions/json?origin="+origin+"&destination="+destination+
"&mode="+Maps.DirectionFinder.Mode.DRIVING+"&alternatives="+Boolean(1)+"&key="+Your_API_KEY;
var options={
muteHttpExceptions:true,
contentType: "application/json",
};
var response=UrlFetchApp.fetch(serviceUrl, options);
if(response.getResponseCode() == 200) {
var directions = JSON.parse(response.getContentText());
if (directions !== null){
return directions;
}
}
return false;
}
, ... API. var serviceUrl. ( ), , . , .
UrlFetch . muteHttpExceptions, , . , , . JSON , . 200 , , getDirections(). false, UrlFetch ( ) null.
, API Google Maps Directions. , , , .