Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How by jql to get issues in the form of JSON from JiraServer using java?

Oleksii Skachkov
Contributor
May 14, 2020

Hi all!

I am developing a plugin and I have the next problem:

- I retrieving from a user a JQL string like this: "project = DEMO"

- then I want to retrieve JSON with issues, but I can retrieve only List<Issue>

example:

String query = "project = DEMO";
Query conditionQuery = jqlQueryParser.parseQuery(query);
ApplicationUser searcher = jiraAuthenticationContext.getUser();
SearchResults results = searchService.search(searcher, conditionQuery, PagerFilter.getUnlimitedFilter());
List<Issue> issues = results.getIssues();

 

Object SearchResult is similar to JSON, retrieving from the link:

http://localhost:2990/jira/rest/api/2/search?jql=project+%3D+DEMO

This JSON is what I need. But I can’t understand how I can get it. Maybe somebody can give me advice - how to convert SearchResult to JSON, or maybe there is another way to get the JSON I need?

1 answer

1 accepted

0 votes
Answer accepted
Natalie Hobson
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 Champions.
January 9, 2013

SORRY, this should be correct now:

project = BOLOGNA AND (status changed FROM "x" to "Z" BEFORE "2012/09/28" or status changed FROM "y" to "Z" BEFORE "2012/09/28")

:)

Natalie Hobson
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 Champions.
January 10, 2013

Are you getting an error, or is the search recognized as valid but has no results?

EdG
January 10, 2013

Thx, but still no results :(

Natalie Hobson
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 Champions.
January 10, 2013

And, if there is no error, can you confirm that both statuses "x" and "y" go directly to "z"? because that is the functionality of changed (went directly from A to B). Instead, are you wanting to search for an issue that was in "x" at some point, or "y" at some point, and at another point was in "z"?

Natalie Hobson
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 Champions.
January 10, 2013

Fiddled around, I think you want this:

project = BOLOGNA AND (status WAS "x" BEFORE "2012/09/28" and status was "Z" BEFORE "2012/09/28" or status WAS "y" BEFORE "2012/09/28" and status was "Z" BEFORE "2012/09/28")

let me know if that works

EdG
January 10, 2013

Great! It works! Thanks Nat.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events