Read JIRA data in SSRS Reports (SQL Server Reporting Services)

Introduction

UPDATE: ZappySys has released a brand new API Connector for Jira Online which makes it much simpler to Read/Write Jira Data in ODBC compared to the steps listed in this article. You can still use steps from this article but if you are new to API or want to avoid learning curve with API then use newer approach.

Please visit this page to see all Pre-Configured ready to use API connectors which you can use in SSIS API Source / SSIS API Destination OR API ODBC Driver (for non-SSIS Apps such as Excel, Power BI, Informatica).

jira-to-ssrsIn our previous blog we saw how to read rest api in SSRS reports. We recommend you go through that article first. In this post we will look at specific example on How to read JIRA data in SSRS Reports (SQL Server Reporting Services), along with few other topics such as how to generate an API Token using Atlassian Account for JIRA REST API Call, how to read all Issues data from JIRA using our ODBC Driver and load it into the SSRS reports.

We will go through the steps to read data from JIRA and Load into SQL Server using JSON Driver of ODBC PowerPack

In nutshell, this post will focus on how to call JIRA API using ODBC PowerPack and how to create SSRS Report.

So let’s get started.

Requirements

  1. Make sure you have SSRS designer installed (You can download SSDT BI for Visual Studio).
  2. Finally, make sure to have ZappySys ODBC PowerPack installed.

What is JIRA

JIRA is Atlassian’s popular project- and issue-tracking platform used by development and technical support teams to get more work done and faster.

It combines:

issue tracking – a software application that allows to record and follow the progress of every problem or “issue” that user identifies until the problem is resolved.
agile project management – an iterative approach to planning and guiding project processes. customizable workflow, and a pluggable integration – integrates with Freshdesk, GitHub, Zendesk, Zapbook, Asana and so on.

Getting Started

First of all, we will see several examples. ZappySys includes an SSIS JSON Source Connector that will help you to call JIRA API, read various data from JIRA with SSIS and do many more actions using REST API. To learn more about JIRA API check this help file.

Generate API Token

To access JIRA data using REST API call you need to generate an API Token in your Atlassian account. Follow the steps mentioned below to generate API Token:
  1. you can directly login to the JIRA Atlassian Cloud site with your credentials, and redirect to the JIRA Atlassian Cloud Account's Profile Page for generating an API Token.
  2. Click API tokens, then Create API token.
    Generate API Token - Step - 1

    Generate API Token - Step - 1

  3. Create API Token - Give Label name to your API token which you are generating now
    Generate API Token - Step - 2

    Generate API Token - Step - 2

  4. Use Copy to the clipboard, and paste the token into your or elsewhere:
    Note:  * For security reasons it isn't possible to view the token after closing the creation dialog; if necessary, create a new token. * You should store the token securely, just as for any password.
    Generate API Token - Step - 3

    Generate API Token - Step - 3

  5. If you forgot API token, then you can Revoke your old API token and create new API token OR you can create multiple API tokens too.
    Generate API token - Step - 4

    Generate API token - Step - 4

Now we have successfully generated an API token. Let´s start with an example. In this example, we will show how to read Tasks/Issues data from JIRA and store that data into a SQL table with SSIS.

About JIRA REST API

JIRA On-premises and Cloud Version both offers REST API. Here are some examples of JIRA REST API. For reading JIRA REST API data we will use JIRA REST API Search method which returns data in JSON format. Search API support use of JQL Syntax to filter issues. If you don't specify JQL parameters in /search endpoint then all issues will be returned. Check this link to learn how to build JQL for JIRA REST API Call. If you don't have JIRA hosted instance yet but still want to try REST API Examples on public JIRA Server then try below URL (Its official JIRA site which lists their own issues). For example, try to copy below URL in a browser and hit enter.
https://jira.atlassian.com/rest/api/2/search?jql=project=JRASERVER

Step-by-Step: Import JIRA data using REST API 

Now once you have API token in the JIRA Atlassian Cloud website we can move to ODBC JSON Driver Configuration Part. For this example purpose you can use the following URL:
https://YOUR-DOMAIN.atlassian.net/rest/api/2/search?startAt=0&maxResults=100&jql=project=MYPROJECT
hence, your-domain is your Atlassian Cloud account’s domain name (we are using zappysys2.atlassian.net). Therefore startAt is the index of the first item returned in the page of results. And another maxResults is the maximum number of items that can be returned per page. Above all, each API endpoint may have a different limit for the number of items returned, and these limits may change without notice. (For more See this JIRA API Documentation for Pagination)

Configure Data Source in Gateway (ZappySys JSON / REST API Driver Example)

Now let's look at how to configure ZappySys Data Gateway. This feature acts as a bridge between Client App and ZappySys Drivers. Using data gateway you can use ZappySys Drivers inside applications / operating systems where ZappySys drivers may not be available directly for some reason (e.g. You don't have access to Server for Installation or System does not support ODBC drivers like JAVA programs). Click here to read more on various use cases of Data Gateway.

Configure Data Gateway User / Port

Now let's look at steps to configure Data Gateway after installation. We will also create a sample data source for ODATA API (i.e. JSON based REST API Service).
  1. Assuming you have installed ZappySys ODBC PowerPack using default options (Which also enables Data Gateway Service)
  2. Search "Gateway" in your start menu and click ZappySys Data Gateway
    Open ZappySys Data Gateway

    Open ZappySys Data Gateway

  3. First make sure Gateway Service is running (Verify Start icon is disabled)
  4. Also verify Port on General Tab
    Port Number setting on ZappySys Data Gateway

    Port Number setting on ZappySys Data Gateway

  5. Now go to Users tab. Click Add icon to add a new user. Check Is admin to give access to all data sources you add in future. If you don't check admin then you have to manually configure user permission for each data source.
    Add Data Gateway User

    Add Data Gateway User

 

Configure Data Source

  1. After user is added, go to Data Sources tab. Click Add icon to create new data source. Select appropriate driver based on your API / File format. You can choose Generic ODBC option to read data from ODBC DSN or use Native Driver option.
    NOTE: Whenever possible use native driver option for better performance / security and ease of use.
    Add Gateway Data Source (Native JSON Driver)

    Add Gateway Data Source (Native JSON Driver)

  2. Now it's time to connect with JIRA. Let's use JSON Driver Data source with the following URL. Change domain with your own domain.
    ODBC JSON Driver: Enter Request URL ODBC JSON Driver: Enter Request URL
  3. It is time to configure the Other Settings. Select HTTP Connection Type from the Connection Type drop-down and Click on Click to Configure Link to Configure the Connection Manager.
    [caption id="attachment_5596" align="alignnone" width="1245"]JIRA REST API Connection - Use ZappySys JSON Driver HTTP Connection JIRA REST API Connection - Use ZappySys JSON Driver HTTP Connection[/caption] JIRA REST API Connection - Use ZappySys JSON Driver HTTP Connection
  4. Now, we are going to set Pagination related configurations for JIRA Search request. Page number indicator must be startAt and maxResults value in URL must match with Increment By (i.e. 100)
    ODBC JSON Driver - JIRA request Pagination Configurations Settings ODBC JSON Driver - JIRA request Pagination Configurations Settings
  5. After adding pagination parameters let's add JQL= search parameter to get specific data. Here we are searching the data by Project name and status. You can find more information about JQL on this link: Search JIRA like a boss with JQL Here is example JQL search query for Public JIRA site. Replace jira.atlassian.com and project JRASERVER with your own values.
    https://jira.atlassian.com/rest/api/2/search?jql=project=JRASERVER
    https://jira.atlassian.com/rest/api/2/search?jql=project=JRASERVER AND status=Open
    https://jira.atlassian.com/rest/api/2/search?jql=project=JRASERVER AND status in (Open,Done)
    https://jira.atlassian.com/rest/api/2/search?jql=project=JRASERVER AND status=Open order by lastViewed DESC
    Search using jql parameter Search using JQL parameter
  6. Click on Select Filter to set the Filter.
    ODBC JSON Driver for JIRA API: Select Filter ODBC JSON Driver for JIRA API: Select Filter
  7. You are done with the Configurations, Click on Test Connection to test the Connection.
    ODBC JSON Driver - Test Connection ODBC JSON Driver - Test Connection
  8. After that select the table from where you want to get data.
    JSON Driver: Create Query of JSON data JSON Driver: Create Query of JSON data
  9. Click on the Preview Data button to preview the data.
    Preview issues table data Preview issues table data
  10. And that’s it, Now we will move forward to the next Phase.

Build your Own JQL Search queries for JIRA Issue

In previous sections we saw some basic JQL queries to search JIRA Issues using API call. Now lets look at how to build such queries using online UI (Think like a query builder). from JIRA.
  1. JIRA has its own public Issue repository which you can browse any time by going here https://jira.atlassian.com/issues/
  2. Now try to change filter settings for search criteria (E.g. change Project, Status etc)
  3. You will notice when you make change your URL keeps changing too. From that URL you can extract ?jql=xxxxxxx  part and use it as template for your own JIRA API search queries.
For more information check how to build JQL for JIRA REST API Call.

Create and configure new SSRS Reports (Using ODBC Connection)

Let’s create a new SSRS project.

  1. In SSRS, in a new Reporting Service Project, add a new Data Source:
    Add REST data source in SSRS

    Add SSRS data source

  2. Also, specify a name for the data source and in type select ODBC. Press Edit to select the ODBC connection for JSON and REST API and select the ZappySys Data Source name that we created before.
    Add ODBC JSON Data Source

    Add ODBC JSON Data Source

  3. Now let’s create a new SSRS report which uses the API data source we created in the previous section.
  4. Right-click on the Reports node and click Add New Report (Wizard mode)
    Add report

    Add new SSRS report

     

  5. In New report, wizard window clicks on next button until you reach the step of query builder like below screen. Now Press the query builder button.
    Note: You can also copy and paste the query directly into the Query string box which we created in the previous phase.

    Create query from REST API

    Query builder

  6. Now, press the Add table icon and go to Views. Select issues(DATA) and press Add.
    ssrs-add-table

    SSRS Add Table

  7. Now remove DATA. prefix from the query so that our query look’s like as below and Click Ok button:
  8. Now press Next Button and select Tabular Report Type and go to next in the following option until the completing wizard and specify a name for the report and finally press the Finish button.
  9. Now click on the Preview a report. It shows the report and exports the REST API data to Word, Excel, PowerPoint, etc:
    SSRS Preview a Report

    SSRS Preview a Report

  10. That’s all we have successfully imported the JIRA data in SSRS Reports (SQL Server Reporting Services).

Conclusion

In this blog, we have learned how to retrieve the data from JIRA using ODBC JSON Driver and then generated the SSRS Reports using those data with ODBC DSN in a very simple way. You can achieve many more functionalities with the use of ODBC PowerPack.

References

Finally, you can use the following links for more information about the use of JIRA API with our tools:

Posted in JSON File / REST API Driver, Reporting - Microsoft SSRS and tagged , , , , , .