Has the Url Shortener in Google Apps Script change

2019-08-03 04:48发布

I've been using this simple function to create shortened links in Google Apps Script. It's been working for the past few months but stopped working few days ago. Has there been a change?

  function getShortenedUrl(url){   

      var longUrl = UrlShortener.newUrl()
      .setLongUrl(url);

      var shortUrl = UrlShortener.Url.insert(longUrl);

      return shortUrl.getId();
}

1条回答
再贱就再见
2楼-- · 2019-08-03 05:05

Yes. It has. I figured it out the hard way. Just make a small change for it to work

function getShortenedUrl(url){   

      var longUrl = UrlShortener.newUrl();
      longUrl.setLongUrl(url);

      var shortUrl = UrlShortener.Url.insert(longUrl);

      return shortUrl.getId();
}
查看更多
登录 后发表回答