The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

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

Proper query string

MichaelMoe
November 10, 2014

I'm using JIRA REST to retrieve tickets assigned to particular developer. This is what I've come up with :

 

http://<JIRA host>/rest/api/2/search?jql=updated>-1h AND assignee in ('david123','daniel123') AND status in ('open','reopened','in progress')

 

It should return zero result, as there is no such username in the database. (I tested it by copying and pasting the same query string in browser address bar and got zero result. ). However, it returns bunch of tickets assigned to other developers. If I use URL encoding for spaces and quotes such as :

 

http://<JIRA HOST>/rest/api/2/search?jql=updated%3E-1h%20AND%20assignee%20in%20(%22david123%22%2C%22daniel123%22)%20AND%20status%20in%20%28%22open%22%2C%22reopened%22%2C%22in progress%22)

 

It gives this error : "Error in the JQL Query: The quoted string 'in' has not been completed. (line 1, character 86)" The same query string works just fine in browsers.

I appreciate much if anyone could point out the mistake I made in my query string.

 

EDIT : I posted the wrong query string and error message. I fixed it just now.

EDIT : Just to give better context, I'm using CURL in PHP script to retrieve those tickets.

 

 

 

 

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

1 vote
Answer accepted
Geert Graat
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 Champions.
November 10, 2014

Hi,

Make sure you have the correct JQL query by using the issue navigator, then copy the relevant part of the URL to use it in the REST call. That will very likely resolve your problem.

Regards,

Geert

MichaelMoe
November 10, 2014

The same query string works just fine(returned expected result) on browser window but it does not for my script.

Geert Graat
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 Champions.
November 10, 2014

Hi, I just copied your query from the first URL (after jql=), pasted it in the issue navigator and then copied the encoded the encoded jql query string from the URL. This is the encoded query string that I got, and it differs from the one you posted: jql=updated>-1h%20AND%20assignee%20in%20(%27david123%27%2C%27daniel123%27)%20AND%20status%20in%20(%27open%27%2C%27reopened%27%2C%27in%20progress%27)

MichaelMoe
November 10, 2014

I found the mistake - I did not replace the space between "in" and "progress" and it was causing the issue. It wasn't an issue with browser, as the browser replaces them. Thanks for pointing that out!

Lucas Henrique Cruz
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 5, 2018

Hi,

 

sorry for asking, but what did you replace the space by? %20?  I´m trying here but it doesn't really works :/

TAGS
AUG Leaders

Atlassian Community Events