Report results export API

Report results export API is available starting from the eazyBI version 4.2.3 (for Jira Server) and in eazyBI for Jira Cloud.

Authentication with embed report token is available from the eazyBI version 4.7.2 for Jira Server and in Jira Cloud.

Overview

eazyBI provides the following report results export URL that you can use to execute the specified report and download the report results:

  • eazyBI for Jira Server:

JIRA_BASE_URL/plugins/servlet/eazybi/
accounts/account_id/export/report/report_id.format

  • eazyBI for Jira Cloud:

https://aod.eazybi.com/accounts/account_id/export/report/report_id.format

Please replace the JIRA_BASE_URL as well as the following parameters:

  • account_id – ID of the corresponding eazyBI account (visible in URLs after /accounts/)
  • report_id – ID of the eazyBI report (when you open the report in the Analyze tab then visible in URL after /reports/ and before -)
    When using eazyBI for Jira Cloud then use the Embed report action to see the account_id and report_id of the report (replace embed with export in the URL).
  • format – specify one of the following supported formats in which you would like to download the results: csv, xls, json, pdf, png
    When using eazyBI for Jira Server please setup export to PDF to enable pdf and png formats.

If your reports contain page filters you can dynamically set value for those filters by passing the value in URL.

  • selected_pages – an optional parameter, one or several full member names separated by a comma for page dimensions. Full member name contains dimension name and eazyBI will automatically match members to page dimension. Please see below example URL with pre-set time and project page filter: ../accounts/99/export/report/42.xls?selected_pages=[Time].[2019],[Project].[Live Demos],[Project].[Active Objects]

At first, test the report results export in your browser and see if it returns expected results. If you would like to automate report results export requests from other applications then you need to provide authentication information for these requests.

Authentication

Report results export API support either HTTP Basic authentication or embed report token authentication.

  • eazyBI for Jira Server

Make the request using Basic authentication with your Jira username and password. Jira Server will validate the username and password and eazyBI will validate if this user has access to the eazyBI account and the specific report.

  • eazyBI for Jira Cloud

Make the request using Basic authentication for REST API with your Atlassian account email and API token.

  • Embed report token

If you have shared the report with a public token then you can add the request parameter ?embed_token=... with the corresponding generated token to authenticate the result export request.

When using basic authentication in scripts, it is recommended to use a separate Jira user with limited read-only to necessary Jira and eazyBI data, as this user password or API token will be stored in those scripts.

When creating an API token in Jira Cloud, it is recommended to create a separate token with a meaningful name (e.g. eazyBI). Then it will be possible to see when this token was used and revoke it if not needed anymore.

Sample node.js script

At first, you need to

  • install Node.js
  • install node-rest-client with the following command: npm install node-rest-client

Then create the attached script file eazybi-export-results.js and update in it Jira base URL and basic authentication parameters. Then use it in the following way:

node eazybi-export-results.js account_id report_id format

and replace account_id, report_id and format as described in the overview. Report results will be written to the standard output, save it to a file if needed.

eazybi-export-results.js
#!/usr/bin/env node

// For Jira Server
var baseURL = "...";
var eazybiBaseURL = baseURL + "/plugins/servlet/eazybi";
// For Jira Cloud
// var eazybiBaseURL = "https://aod.eazybi.com";

var accountId = process.argv[2];
var reportId = process.argv[3];
var format = process.argv[4] || "csv" // other available formats: json, pdf, png

// Provide user and password for Jira Server or user email (as user) and API token (as password) for Jira Cloud
var options_auth = {
  user: "...",
  password: "..."
}

var Client = require('node-rest-client').Client;
client = new Client(options_auth);

if (!accountId) {
  throw "Missing account ID argument";
}

if (!reportId) {
  throw "Missing report ID argument";
}

// Set if using self-signed SSL certificates which should not be validated
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";

client.get(eazybiBaseURL + "/accounts/" + accountId + "/export/report/" + reportId + "." + format,
  function(data, response) {
    if (response.statusCode == 200) {
      if (format == "csv") {
        console.log(data.toString("utf8"));
      } else if (format == "json") {
        console.log(JSON.stringify(data, null, '  '));
      } else {
        process.stdout.write(data);
      }

    } else {
      console.log("Error code", response.statusCode);
      throw "Export report results request failed";
    }
  }
);