Forums

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

REST API query issue

Benjamin Pea February 18, 2020

Hi everyone,

I am a newbie here.  I am running Jira Server on-prem (version 7.6.4).  I am trying to find all issues updated in the last hour with the URL below and it works fine.

/rest/api/2/search?jql=updated>=-1h

However, when I tried to find all issues within Jira Key "ZYX" that were updated within the last hour, it returned issues that were updated in 2019.  What am I doing wrong? 

/rest/api/2/search?jql=project=ZYX&updated>=-1h

Thanks in advance for your help!

Best!

2 answers

1 accepted

0 votes
Answer accepted
Benjamin Pea February 18, 2020

Hi everyone,

I believe I got it figured out.  In case anyone runs into the same issue, you could try 

/rest/api/2/search?jql=project=ZYX%20AND%20%20updated>=-1h

This is how I got it to work.  Thanks again for everyone's help!

Best,

Ben

0 votes
Jack Nolddor _Sweet Bananas_
Atlassian Partner
February 18, 2020 edited

Hi Benjamin Pea,

 

As per documentation says:

 

Use one of the following formats:

"yyyy/MM/dd HH:mm"
"yyyy-MM-dd HH:mm"
"yyyy/MM/dd"
"yyyy-MM-dd"

Or use "w" (weeks), "d" (days), "h" (hours) or "m" (minutes) to specify a date relative to the current time. The default is "m" (minutes). Be sure to use quote-marks ("); if you omit the quote-marks, the number you supply will be interpreted as milliseconds after epoch (1970-1-1).

 

 

So believe you must use the following URL instead:

/rest/api/2/search?jql=project=ZYX&updated>="-1h"

 

 

Regards

Benjamin Pea February 18, 2020

Hi Jack,

Thanks for the quick response, it doesn't look like it's returning the expected response.  I am still getting issues that were updated in January.

I even tried 

/rest/api/2/search?jql=project=ZYX&updated>="2020-02-18" but still getting incorrect results.

Thanks again for your help. Hopefully you or someone else can figure out what I am doing wrong.

Best,
Ben
Benjamin Pea February 18, 2020 edited

Hi everyone,

I believe I got it figured out.  In case anyone runs into the same issue, you could try 

/rest/api/2/search?jql=project=ZYX%20AND%20%20updated>=-1h

This is how I got it to work.  Thanks again for everyone's help!

Best,

Ben

Jack Nolddor _Sweet Bananas_
Atlassian Partner
February 18, 2020

OMG! How can I miss the AND operator while checking for your error.... :(

I didn't notice the typo on the JQL... Next time, to avoid this kind of problems, you better generate the JQL on the UI and the simply use the /rest/api/2/search endpoint to get the results over REST API once it works on Jira itself like this:

/rest/api/2/search?jql=<A WORKING JQL HERE>

 

Regards

Like • Benjamin Pea likes this

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, atlassian community, loom ai, atlassian loom ai, loom, atlassian ai, record recaps of meetings, meeting recaps, loom recaps, share meeting recaps,

Loom’s guide to great meetings 📹

Join us to learn how your team can stay fully engaged in meetings without worrying about writing everything down. Dive into Loom's newest feature, Loom AI for meetings, which automatically takes notes and tracks action items.

Register today!
AUG Leaders

Atlassian Community Events