Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,556,218
Community Members
 
Community Events
184
Community Groups

Problem converting JQL to API calls

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?

3 answers

1 accepted

0 votes
Answer accepted


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)
}
0 votes
Prince Nyeche
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 Leaders.
Mar 20, 2023

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.

0 votes
Bill Sheboy
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 Leaders.
Mar 20, 2023

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

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events