I'm having problems constructing Jira queries using the Jira API.
For instance, if I use the following query from Jira:
project=onsip AND status in (Tabled) AND "Shortcut ID[Number]" = "10368" order by created DESCI get a single result: https://oomacorp.atlassian.net/browse/ONSIP-521
However, when I try to runhttps://oomacorp.atlassian.net/rest/api/3/search?jql=project=onsip&status=Tabled&Shortcut ID[Number]=10368from the API, orhttps://oomacorp.atlassian.net/rest/api/3/search?jql=project=onsip&status=Tabled&Shortcut%20ID[Number]=10368from a browser, I get other results.
Can you tell me what is wrong with my syntax to the API/browser?
Thanks, Bill.Indeed, when I use the below, I get the expected results:
"10368" order by created DESCproject = "onsip"#status = "Tabled"status = '(Tabled, "Tier 4 Accepted")'shortcut_id = "10368""""query_string = {"jql": 'project=ONSIP AND status in (Tabled, "Tier 4 Accepted") AND "Shortcut ID[Number]"="10368" order by created DESC'}"""query_string = {"jql": 'project={project} AND status in {status} AND "Shortcut ID[Number]"="{shortcut_id}" order by created DESC'.format(project=project,status=status,shortcut_id=shortcut_id)}
Hi @Ron Barak
It appears you have changed your JQL to substitute ampersands (&) for the AND operator, which is not going to work.
I recommend either replacing these manually with %20AND%20 to escape the spaces around the operator, or run your query from advanced issue search, and then grab the well-formed query from the browser address bar.
Kind regards,Bill
You can URL encode the JQL string, that would be the approach to take. So this
project=onsip AND status in (Tabled) AND "Shortcut ID[Number]" = "10368" order by created DESC
becomes
project%3Donsip%20AND%20status%20in%20%28Tabled%29%20AND%20%22Shortcut%20ID%5BNumber%5D%22%20%3D%20%2210368%22%20order%20by%20created%20DESC
Using google, there are free online URL encoders out there.
It looks like you're new here. Sign in or register to get started.