Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 21:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

how to write a date filter condition in API

Jean Wang November 22, 2022

I want to filter data by update date. something like below:

https://companydomain.atlassian.net/rest/api/3/search?jql=project in ('WCH')&update>='2022-08-01'&maxResults=0

 

I tried the url, the update filter doesn't work. 

1 answer

1 accepted

0 votes
Answer accepted
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.
November 22, 2022

Hello @Jean Wang 

The keyword in JQL syntax for joining statements is AND.

https://companydomain.atlassian.net/rest/api/3/search?jql=project IN (WCH) AND update >= 2022-08-01&maxResults=50

Ampersands (&) are interpreted in REST API requests as parameter delimiters, so you were passing a parameter 'update' that the REST API couldn't understand, so it just ignored it.

Next, you don't really need the inverted commas in the JQL if the value being searched for doesn't have any spaces in the name, as per my example shown.

Lastly, sending the parameter maxresults=0 would be ignored too. The maxresults parameter is for restricting the total number of results returned, and you can't restrict that to zero.

Jean Wang November 23, 2022

Thank you so much, David!  A great introduction to JQL.

below is the version  I used and it works this time. maxResults=0 returns the total numbe of records in the query, in my case, it gives me the total number of issues under the filter condition.

https://companydomain.atlassian.net/rest/api/3/search?jql=project IN (WCH) AND 'updatedDate'>='2022-08-01'&maxResults=0

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.
November 23, 2022

Try again and omit the entire '&maxResults=0' part of the query. I think you'll find the REST API returns the exact same number of results, up to the default maximum of 50.

For Jira Cloud, the largest value that you can set for maxResults, and the maximum number of items that will be returned for a single request before pagination of the results occurs, is 100. This is a hard set limit, as documented in feature request JRACLOUD-67722

Refer to the Expansion, pagination and expansion section of the REST API documentation to better understand how the total, startAt, maxResults and isLast parameters are used together for parsing paginated results.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events