You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
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 DESC
I get a single result: https://oomacorp.atlassian.net/browse/ONSIP-521
However, when I try to run
https://oomacorp.atlassian.net/rest/api/3/search?jql=project=onsip&status=Tabled&Shortcut ID[Number]=10368
from the API, or
https://oomacorp.atlassian.net/rest/api/3/search?jql=project=onsip&status=Tabled&Shortcut%20ID[Number]=10368
from 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 DESC
project = "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)
}
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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 must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.