Using Google Scripting to export eazyBI report into Google Drive

I am trying to develop a Google script that will export an xls format eazyBI report to my company’s Gdrive. My script is currently failing at the fetch URL step and I need help in troubleshooting the issue.

Here are the steps that I have followed:

  1. created a direct download URL for the report (for Jira server) using the instructions provided here.

My URL looks as follows: JIRA_BASE_URL /plugins/servlet/eazybi/accounts/account_id /export/report/report_id .xls
I have validated that this URL works fine from a web browser.

  1. Next, I constructed a basic auth header following the steps given here.
    a. Built a string of the form username:password.
    b. Encode the string to Base64.

  2. Finally my google script goes as follows:

    var fileURL = ‘<direct download URL created in step 1 above>’;
    var base64Token = '<base64 encoded string as per the step 2b above>

var params = {
method : “get”,
headers : {“Authorization” : "Basic " +base64Token },
muteHttpExceptions : true
};
var response = UrlFetchApp.fetch(fileURL,params);

My script is failing at the last line (var response = UrlFetchApp.fetch(fileURL,params)), with an Error Message → Exception: DNS error

I am relatively new to google scripting and javascript. Will greatly appreciate the community’s help in guiding me where I am going wrong and how to fix this issue.

Hi Rizwan,

Welcome to the eazyBI community!
From the error message, it seems that there are problems with resolving your Jira host. Could it be that you have provided an internal Jira hostname? Or maybe your Jira instance isn’t accessible outside your company?

Best regards,
Janis