Query JIRA using Java API

Mohamed Suhail July 19, 2016

Hi,

Brief Background: I am working on developing a custom plugin that would collect statistical data about a projects or projects (depending on the administrative account login) and provide a detailed report with charts highlighting this information.

 

Curiosity: Looking at the material available online I noticed a lot of emphasis towards the use of JIRA REST API, this is great and interesting of course, and I have used this previously. I would like to know whether it is possible with the JIRA-API maven dependency (Java API) to query the projects for statistical information very similar to the REST API. For example, is there a service class I could use to query the number of all the issues created for a given project, or, count the number of issues created or resolved by a particular user or date,very similar to SQL querying. 
 

Any material available on this would be highly appreciate. 

Thank you & Regards,

Suhail

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

4 votes
Answer accepted
Volodymyr Krupach
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 19, 2016

Hi Mohamed,

I do it like:

String query = "project = DEMO";
Query conditionQuery = jqlQueryParser.parseQuery(query);
SearchResults results = searchService.search(jiraAuthenticationContext.getUser(), query, PagerFilter.getUnlimitedFilter());

If it's your first JIRA addon you need to study docs: https://developer.atlassian.com/jiradev/jira-platform/building-jira-add-ons/jira-plugins2-overview. Also make sure to check atlassian-scanner https://bitbucket.org/atlassian/atlassian-spring-scanner since it't the place where all newcomers stuck.

Allan Wojcik da Silva February 6, 2019

Have you got more examples? I can't find any on the official documentation... nor even Google is helping me... thanks.

Like DEVIAPHAN likes this
TAGS
AUG Leaders

Atlassian Community Events