Jira API JQL-search fails with createdDate and project

Jira Software version: 7.3.0


I cannot perform API search queries asking for "createdDate" and "project".

curl -D- -u xxx:yyy -X GET -H "Content-Type: application/json" /rest/api/2/search\?jql\=createdDate%20%3E%3D%20-30d

works, but

curl -D- -u xxx:yyy -X GET -H "Content-Type: application/json" /rest/api/2/search\?jql\=project%3DGS%20AND%20createdDate%20%3E%3D%20-30d

does not. Error is

HTTP/1.1 403 Forbidden
Date: Mon, 10 Jul 2017 10:12:46 GMT
Server: Apache
Content-Length: 226
Content-Type: text/html; charset=iso-8859-1

<title>403 Forbidden</title>
<p>You don't have permission to access /rest/api/2/search
on this server.<br />

I suppose that it is no permission error but some kind of problem with the query.


Thanks in advance!



1 answer

0 votes

Hmm.  What happens if you search just for the project and drop the date part?

i.e. just  "project = GS" or jql\=project%3DGS in the url.

This works. Changing createdDate and project does not work either.

Running the JQL query directly via Jira works.

Right, I meant specifically the url based query with just the project - does that pull back all the project issues for GS?

It returns the "first 50" setting maxResults to 50 and strting at 0. "total" returns the correct total number of issues.

So, let me repeat this back to you to ensure I have it clear:

These two calls work, pulling back issues:

  • curl -D- -u xxx:yyy -X GET -H "Content-Type: application/json" /rest/api/2/search\?jql\=createdDate%20%3E%3D%20-30d
  • curl -D- -u xxx:yyy -X GET -H "Content-Type: application/json" /rest/api/2/search\?jql\=project%3DGS

And the third call, where there are both clauses joined by an AND gives you a permission error.

Yes, exactly.

I have just found the problem: Removing the "=" from ">=-30" fixes the problem. So I transformed ">=-30" to ">-31".

Perhabs the "-" is interpreted as an assignment by the server.

Ahh, nicely spotted.  I think you might need to escape it in the url.

Yes, that should work, too.

Thanks for your investigations!

But I have a new problem...


does not work in my node.js Code but works via curl. It is an SSL connection so I cannot use Wireshark to analyse both streams.

Any suggestions?

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 27, 2018 in Portfolio for Jira

Introducing a new planning experience in Portfolio for Jira (Server/DC)

In the past, Portfolio for Jira required a high degree of detail–foresight that was unrealistic for many businesses to   have–in   order to produce a reliable long-term roadmap. We're tur...

2,763 views 18 21
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you