All eazyBI for Jira eazyBI for Confluence Private eazyBI

Report results export API

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

  • Atlassian Data Center: BASE_URL/plugins/servlet/eazybi/accounts/account_id/export/report/report_id.format
  • Atlassian Cloud: https://aod.eazybi.com/accounts/account_id/export/report/report_id.format
  • eazyBI.com: https://eazybi.com/accounts/account_id/export/report/report_id.format
  • Private eazyBI: <eazyBI host and port>/eazybi/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 Data Center 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. The 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.

Note this export API works for retrieving a report data but does not work for a dashboard. More details on options to download dashboard data read here: Create dashboards.

Authentication

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

  • Atlassian Data Center

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

  • Atlassian 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 user with limited read-only access rights, as this user's password or API token will be stored in those scripts.

When creating an API token in Atlassian 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.

MultiPass authentication for Private eazyBI

Please see MultiPass authentication documentation on how you can set up and create MultiPass tokens.

You can use MultiPass authentication if you would like to create automated scripts which download eazyBI report results:

  1. When creating the MultiPass token, you need to include in it to attribute which is relative URL of the results export:
    /eazybi/accounts/account_id/export/report/report_id.format
  2. Make the request to the following URL (replace the site_key with the corresponding name you used in eazybi.toml):
    <eazyBI host and port>/eazybi/users/multipass/site_key?multipass=multipass_token
  3. After successful authentication, the request will be redirected to the report results export URL.

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 Data Center
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 Data Center 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";
    }
  }
);