When using Jira, you will want to access your projects from other systems. This will require you to integrate Jira with the system. The best approach to accomplish this is by the use of the Jira REST API. It allows you to access the Jira platform from third-party systems without interacting with Jira’s interface. You can then issue various JQL commands to know more about your Jira Projects. You can also use the Jira API GET issue to know more about the issues of your projects.
This article discusses how to use JQL with Jira REST API.
Table of Contents
Introduction to JIRA
Jira is a popular tool for project management. The word Jira is derived from a truncation of the Japanese word “Gojira” which means “Godzilla” as developers in Atlassian used to refer to Jira as Bugzilla because it was initially used for just bug tracking.
It allows the teams working on a project to collaborate with other teams to steer the project towards completion. With Jira, the teams can see who has been assigned to which task and the progress of different tasks. Jira is also good for Bug Tracking. The teams can track both resolved and unresolved bugs and take the necessary actions. It is also possible to know which team member has been assigned to which project issue. This makes Project Management an easy task.
Jira is a suite of agile work management solutions that powers collaboration across teams to help you plan, assign, track, report, and manage work and brings teams together for everything from agile software development to customer support.
Jira has become popular over the years and it is used by over 180,000 customers in more than 190 countries, it has listed products such as Jira Software, Jira Service Management, Jira Work Management, and Jira Align.
To explore Jira in detail, visit the Jira Homepage.
Prerequisites
To work with Jira REST API, you’ll need:
Part 1: Understanding Jira REST APIs
The Jira REST APIs help you to integrate Jira with third-party applications. You can also use the REST APIs to develop Add-Ons for Jira or Script Interactions with Jira.
With the Jira REST APIs, you can interact with the Jira software remotely. The interaction is normally done using URI paths.
To use a Jira REST API, an application has to make an HTTP request and parse the response. The REST API uses JSON format for communication, and HTTP methods such as GET, POST, PUT, and DELETE. The URIs for the Jira REST API takes the following format:
http://host:port/context/rest/api-name/api-version/resource-name
With Jira REST APIs, you can use Jira without having to interact with its User Interface (UI).
Part 2: Understanding JQL
JQL (Jira Query Language) provides the best way for Jira users to search for their Jira issues. It can be used by anyone, including developers, agile project managers, testers, and business users.
Knowing how to search for issues in Jira can help you to save time. It can also help you to get exactly what you want. A combination of JQL with Jira REST API can help you to run JQL queries from remote systems. You can run Jira API GET issue queries to get details about the various issues you come across in your Jira projects.
JQL uses the following data to filter issues:
- Fields
- Values
- Operators
- Functions
- Keywords
For example, to search for all unplanned issues, you can search for issues whose status field is not closed.
Let’s look at some of the salient features of Hevo:
- Fully Managed: It requires no management and maintenance as Hevo is a fully automated platform.
- Data Transformation: It provides a simple interface to perfect, modify, and enrich the data you want to transfer.
- Real-Time: Hevo offers real-time data migration. So, your data is always ready for analysis.
- Schema Management: Hevo can automatically detect the schema of the incoming data and map it to the destination schema.
- Scalable Infrastructure: Hevo has in-built integrations for 100’s of sources that can help you scale your data infrastructure as required.
- Live Monitoring: Advanced monitoring gives you a one-stop view to watch all the activities that occur within Data Pipelines.
- Live Support: Hevo team is available round the clock to extend exceptional support to its customers through chat, email, and support calls.
Sign up here for a 14-day free trial!
Part 3: How to use JQL with Jira REST APIs
In this section, you will understand how to use the Jira API GET issue query to get the details of various Jira Project Issues. The Jira REST API JQL allows you to send a query and get a subset issue.
The GET Method
The GET Method can help us to query data from Jira. For example let’s query for the issues that have been assigned to a particular user say, johnie. We will pass a single URL parameter (JQL) which has a JQL query as shown below:
curl -D-
-u johnie:johnie
-X GET
-H "Content-Type: application/json"
https://johnie:8081/rest/api/2/search?jql=assignee=johnie
The above Jira API GET issue query will return the list of issues assigned to the user johnie. The output will be in JSON format.
We can also query the issues assigned to the user johnie and at the same time restrict the number of results. This requires us to supply two additional parameters to the Jira API GET issue query, that is, startAt and maxResults. These parameters specify the starting issue to be returned in the JQL results and the number of issues to be returned from the starting issue. The following query demonstrates this:
curl -D-
-u johnie:johnie
-X GET
-H "Content-Type: application/json"
http://johnie:8081/rest/api/2/search?jql=assignee=johnie&startAt=2&maxResults=2
In the above Jira API GET issue, we are starting at issue number 2 and the query should only return a maximum of 2 issues from the starting issue. The query will return only 2 issues in a JSON format.
We may also need to order the results returned by the query. We can add an “order by” clause to the JQL query. This is shown below:
curl -D-
-u johnie:johnie
-X GET
-H "Content-Type: application/json"
http://johnie:8081/rest/api/2/search?jql=assignee=johnie+order+by+duedate
The above Jira API GET issue will order the results based on the due date parameter. It is also possible to restrict the fields of the returned results. We can add an additional field to the query, that is, fields, to list the Jira fields returned in the JQL results. The fields in the list should be separated using commas (,). The following query demonstrates this:
curl -D-
-u johnie:johnie
-X GET
-H "Content-Type: application/json"
'http://johnie:8081/rest/api/2/search?jql=project=QA+order+by+duedate&fields=id,key'
The Jira API GET issue query will return the output in a JSON format and it will only show the details of two fields, that is, id and key, as they are the ones passed to the fields parameter in the query.
And that is how you can query for issues using the Jira API GET issue query.
The POST Method
You can also send queries using the POST request. This should be the case when the JQL query is too big to be specified in a URL parameter. The JQL query should be posted to the “search” resource of the REST API in JSON format. Other URL parameters (to url) should be added to your JSON-formatted JQL query. Consider the following example:
curl -D-
-u johnie:johnie
-X POST
-H "Content-Type: application/json"
--data '{"jql":"project = QA","startAt":0,"maxResults":2,"fields":["id","key"]}'
"http://johnie:8081/rest/api/2/search"
And that is how you can query for issues using the Jira API JQL POST issue query.
Conclusion
JQL commands can be implemented to know more about your Jira Projects. You can also use the Jira API GET issue to know more about the issues of your projects. This is what you’ve learnt in this article:
- You’ve learnt more about Jira REST APIs.
- You’ve learnt more about JQL.
- You’ve learnt how to use JQL with Jira REST APIs.
- You’ve learnt how to implement Jira API GET issue.
To further increase your productivity and business know-how, combining Jira with Hevo Data can be very helpful as Hevo Data has baked in Jira support alongside access to other providers in its Data Warehousing Platform.
visit our website to explore hevo
Hevo Data with its strong integration with 150+ Data Sources & BI tools such as JIRA (a free Data Source) allows you to not only export data from sources & load data in the destinations, but also transform & enrich your data, & make it analysis-ready so that you can focus only on your key business needs and perform insightful analysis using BI tools.
Hevo Data is a No-code Data Pipeline that offers a fully managed solution to set up data integration from JIRA (one of the 30+ Free Data Sources) and 150+ Data Sources and will let you directly load data to a Data Warehouse or the destination of your choice. It will automate your data flow in minutes without writing any line of code. Its fault-tolerant architecture makes sure that your data is secure and consistent. Hevo provides you with a truly efficient and fully automated solution to manage data in real-time and always have analysis-ready data.
Give Hevo Data a try and sign up for a 14-day free trial today. Hevo offers plans & pricing for different use cases and business needs, check them out!
Do you use JIRA? Share your experience of working with the Jira API GET issue.