Converting JQL to get a list of stories worked on during a time window using the Jira API

Darryl Blackwell April 1, 2021

Hi,

I have a JQL query I use in Jira I'd like to convert to a Jira API call.

Having gone through the API documentation, I can't see how I might easily achieve this, and would appreciate any advice. 

I want to get the list of stories that have a changed to a given status in a given time window. The JQL is as follows:

  issuetype in (Story, Bug, Release)

  and status changed to ( "In development",  "In Code review", "In testing")

  during ("2021/03/01", now())

I have tried   GET /rest/api/3/worklog/updated, but this doesn't seem to work. 

Any advice greatly appreciated.

2 answers

1 accepted

0 votes
Answer accepted
Bloompeak Support
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
April 1, 2021

Hi @Darryl Blackwell ,

You can pass jql as parameter to the search rest api below /rest/api/2/search?jql={yourJQL}

https://docs.atlassian.com/software/jira/docs/api/REST/7.6.1/#api/2/search-search

0 votes
Bill Sheboy
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.
April 1, 2021

Hi @Darryl Blackwell -- Welcome to the Atlassian Community!

I am using Cloud version, but I found this documentation on JQL searches using the server REST API.  Please check if that helps you.

https://developer.atlassian.com/server/jira/platform/jira-rest-api-examples/#searching-for-issues-examples

 

Best regards,

Bill

Darryl Blackwell April 21, 2021

Bill / Bloompeak Support - many thanks for your answers - worked a treat :-) 

I also found the overhead of returning 200x items in a single call much greater in terms of execution time vs 4x requests of 50x items.   

Bill Sheboy
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.
April 21, 2021

Hi, Darryl.  I am glad that worked for you. 

Your result of the single call with the larger set being much slower seems interesting.  Did you end up making multiple calls, incrementing startAt?

Darryl Blackwell April 21, 2021

Yes - I created a method that issued the original JQL call and set the startAt value to 0 and maxResults to 50.

The response gives an array of up to 50 issues and a ‘total’ value that shows how many items the query returned across pages.

if the total results value exceeded the page size (of 50), I setup a call chain in  NodeJS/JavaScript that created an array of Url request promises with the startAt value incremented by the page size, then executed a Promise.all() and these then execute in (relative) concurrency. 

The 19x batched concurrent calls appeared to execute in a rough order of magnitude quicker than a single call which would returning all items (982 in the test case), which surprised me. 

Must be some overhead in serialising the response and returning a large dataset over the wire in one go I guess...

Like Bill Sheboy likes this

Suggest an answer

Log in or Sign up to answer