Google Apps Script: Http GET Request With Query Parameter

July 31, 2019
function generateQueryString(data) {
   const params = [];
   for (var d in data)
      params.push(encodeURIComponent(d) + '=' + encodeURIComponent(data[d]));
   return  params.join('&');
}

function test() {
  var data = {'name': 'Desmond', 'age': '40'}
  var response = UrlFetchApp.fetch('https://www.mywebsite.com/do_something?' + generateQueryString(data));
  Logger.log(response.getContentText());
}

References:

This work is licensed under a
Creative Commons Attribution-NonCommercial 4.0 International License.