How to filter out all the issues that had some kind of worklog update since a certain date?

mateus.santos December 6, 2021

Hi,

I'm having some difficulties getting to use Jira's Rest API.
I'm currently wanting to jql filter all worklogs for a certain period of time (say from last Monday).

I have been using the following search:

https://myWorkspace/rest/api/2/search?jql=project=MyProject&worklogDate>='2021-10-01'&maxResults=2000&ORDER%20BY%20Created

My idea is that this search returns all issues (I need their key) that had some kind of udpate in their worklog (whether they are old or new issues - cards).

The problem is: even using the exact same worklogDate field that I use in Google Sheets (Jira Clouds for Sheets) to do the date search, it doesn't seem to work. The issues that come keep coming only in order of creation, which makes searching the worklogs very slow (I need to go through issue by issue looking for which ones had some kind of update in their worklog, comparing by the date I want).

I've also tried using the following search type:

https://myWorkspace/rest/api/3/worklog/updated?since=1572442575846

Which theoretically returns me all worklogs of all projects from a certain date.

The problem is that this type of search only returns the ID of each worklog, and I can't access the issue key from it (at least I haven't found how to do this so far). If I could get the issue key, it would be perfect, but just with the worklog ID I don't have enough information to perform other searches.

Basically I need to filter out all the issues that had some kind of worklog update since a certain date.
Does anyone know how to do this?

1 answer

0 votes
David Bakkers
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.
December 6, 2021

Hello @mateus.santos 

You're using JQL's syntax incorrectly. To include something in a JQL statement, you need to use the word AND, not ampersands. Also, you put the ORDER BY part of the JQL outside the JQL statement too.

The request should be (For ease of reading, I've left the spaces unencoded):

/rest/api/{version}/search?jql=project={key} AND worklogDate>='2021-10-01' ORDER BY created&maxResults=2000

Refer to the JQL documentation for the proper syntax.

mateus.santos December 7, 2021

Thank you for your help!

I applied the correct syntax (it really makes more sense), but I realize the problem still exists. It even filtered the issues better (they're coming more specifically, rather than all), but older issues (which have been udpate in the worklog recently) aren't coming in the search yet, just the newer ones. I even tested it by removing the "ORDER BY" field, but it made no difference.

Could you say why the oldest issues don't come in this search? (Even with a recent worklog update).

David Bakkers
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.
December 7, 2021

@mateus.santos 

Good to hear that you've gotten a grasp of JQL syntax. As for why some 'older' issues with specific worklog dates aren't being found, you've not provided much information.

  • What do you mean by 'older'? Older than what or when?
  • When you inspect a specific issue that's got an 'old' date and you get the worklog date from it, can you find it when you search in that narrow worklog date range?
  • What tests have you done to narrow the scope of the problem?

This is where you'll need to do your own experiments to reduce the problem down and work out what what's causing the search to not include the specific issues you expect.

Start with a Google search of 'jira jql worklogdate range' for other threads by people with similar questions.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events