I\'m trying to query the goo.gl API from inside a Google Apps Script. The problem I\'m seeing is the following error message:
Request failed for https://www.
The following code works perfectly.
function ShortenUrl(){
var url = 'https://www.googleapis.com/urlshortener/v1/url';
var apiKey = 'AIzBlNS-3HZdxKgwj-x30';
url += '?key=' + apiKey;
var payload = {"longUrl":"www.google.com"};
var parameters = { method : 'post',
payload:JSON.stringify(payload),
contentType:'application/json',
muteHttpExceptions:true};
var response = UrlFetchApp.fetch(url, parameters);
Logger.log(response);
}