- 1 Introduction
- 2 Requirements
- 3 What is JIRA
- 4 Getting Started
- 5 Generate API Token
- 6 About JIRA REST API
- 7 Step-by-Step: Import JIRA data using REST API
- 8 Configure Data Source in Gateway (ZappySys JSON / REST API Driver Example)
- 9 Conclusion
- 10 References
IntroductionIn 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.
- Make sure you have SSRS designer installed (You can download SSDT BI for Visual Studio).
- 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.
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.
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 TokenTo 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:
- 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.
- Click API tokens, then Create API token.
- Create API Token - Give Label name to your API token which you are generating now
- Use Copy to the clipboard, and paste the token into your or elsewhere:
- 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.
About JIRA REST APIJIRA 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.
Step-by-Step: Import JIRA data using REST APINow 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=MYPROJECThence, 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 / PortNow 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).
- Assuming you have installed ZappySys ODBC PowerPack using default options (Which also enables Data Gateway Service)
- Search "Gateway" in your start menu and click ZappySys Data Gateway
- First make sure Gateway Service is running (Verify Start icon is disabled)
- Also verify Port on General Tab
- 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.
Configure Data Source
- 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.
- 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.
- 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.
- 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)
- 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
- Click on Select Filter to set the Filter.
- You are done with the Configurations, Click on Test Connection to test the Connection.
- After that select the table from where you want to get data.
- Click on the Preview Data button to preview the data.
- And that’s it, Now we will move forward to the next Phase.
Build your Own JQL Search queries for JIRA IssueIn 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.
- JIRA has its own public Issue repository which you can browse any time by going here https://jira.atlassian.com/issues/
- Now try to change filter settings for search criteria (E.g. change Project, Status etc)
- 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.
Create and configure new SSRS Reports (Using ODBC Connection)
Let’s create a new SSRS project.
- In SSRS, in a new Reporting Service Project, add a new Data Source:
- 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.
- Now let’s create a new SSRS report which uses the API data source we created in the previous section.
- Right-click on the Reports node and click Add New Report (Wizard mode)
- 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.
- Now, press the Add table icon and go to Views. Select issues(DATA) and press Add.
- Now remove DATA. prefix from the query so that our query look’s like as below and Click Ok button:
1SELECT issues.* FROM issues
- 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.
- Now click on the Preview a report. It shows the report and exports the REST API data to Word, Excel, PowerPoint, etc:
- That’s all we have successfully imported the JIRA data in SSRS Reports (SQL Server Reporting Services).
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.
Finally, you can use the following links for more information about the use of JIRA API with our tools:
- JIRA Documentation for API
- Landing Page for ODBC JSON / REST API Driver, you can also find Tutorial Video here.
- Help File: Documentation of JSON Driver.
- Blog/articles link: https://zappysys.com/blog/category/odbc-powerpack/odbc-drivers/json-rest-api-driver/