title: Google Apps Script and fetching JSON with UrlFetchApp
body: <p>I am trying to retrieve JSON from a website using UrlFetchApp</p>
  
  <p>I have learned over the last few days that Google Apps Scripts (GAS) does not support encoding  logon credentials in the url, which is the preferred method for accessing the target website.</p>
  
  <p>The website does not support using headers to provide basic authentication parameters such as:</p>
  
  <pre><code>Logger.log('Basic Auth in header');
    var url2 = 'http://website.com'
   var response = UrlFetchApp.fetch(url2, {
     headers: {
       'Authorization': 'Basic ' + Utilities.base64Encode('logon parms')
     },
     muteHttpExceptions: true
   });
   Logger.log('Response Code: ' + response.getResponseCode());
  }
  </code></pre>
  
  <p>I get a 'Not found' error with the above, but it is apparently authenticating successfully, since if I change the password, it returns a 'Unauthorized' error.</p>
  
  <p>My question - is there any other way to fetch JSON using GAS, or am I out of luck?</p>