🚧app.fetch()

// 🔸 app.fetch(url) -> JSON object
app.fetch = function (url){

  // connect to API endpoint
  var response = UrlFetchApp.fetch(url, {
    // this setting means your code won't halt ⭐️
    // if the request results in an API error. 
    // Instead, the error response (HTTPResponse) is returned.
    'muteHttpExceptions': true
  });
  
  // convert response to json object
  var json = response.getContentText();
  return JSON.parse(json); 
};

Last updated