It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Rest Api Query shows other hits than RunJira Search Edited

Hi together,

 

hope someone can help me. For privacy reasons, I censor hostnames and main URLs.

 

I'm currently coding a script and i need a simple runjira query:

Search all open tickets for hostname XYZ* in four fields and only status open (not closed).

 

First, I built a query in the RunJira search bar:

 

Here is my link:

https://RUNJIRAURL.com/issues/?jql=summary%20~%20%22XYZ1*%22%20AND%20status%20!%3D%20Closed%20OR%20description%20~%20%22XYZ1*%22%20AND%20status%20!%3D%20Closed%20OR%20Identifier%20~%20%22XYZ1*%22%20AND%20status%20!%3D%20Closed%20OR%20comment%20~%20%22XYZ1*%22%20AND%20status%20!%3D%20Closed

 

And for better illustrate my query in the search bar:

summary ~ "XYZ1*" AND status != Closed OR description ~ "XYZ1*" AND status != Closed OR Identifier ~ "XYZ1*" AND status != Closed OR comment ~ "XYZ1*" AND status != Closed

 

It Works fine ! For the hostname XYZ1 I find two open tickets, fits perfect!

 

Now i can do the same search via Api:

 

My Api URL:

https://RUNJIRAURL.com/rest/api/2/search?jql=summary%20~%20%22XYZ1*%22%20AND%20status%20!%3D%20Closed%20OR%20description%20~%20%22XYZ1*%22%20AND%20status%20!%3D%20Closed%20OR%20Identifier%20~%20%22XYZ1*%22%20AND%20status%20!%3D%20Closed%20OR%20comment%20~%20%22XYZ1*%22%20AND%20status%20!%3D%20Closed

 

My curl in script:

#!/bin/bash

curl -X GET "https://RUNJIRAURL.com/rest/api/2/search?jql=summary%20~%20%22$HOST*%22%20AND%20status%20!%3D%20Closed%20OR%20description%20~%20%22$HOST*%22%20AND%20status%20!%3D%20Closed%20OR%20Identifier%20~%20%22$HOST*%22%20AND%20status%20!%3D%20Closed%20OR%20comment%20~%20%22$HOST*%22%20AND%20status%20!%3D%20Closed" --cookie "JSESSIONID=$SESSIONID"

 

Its the same Query like the Runjira search bar except from the main url, but now i find seven tickets, two open and five closed... but why? its the same query i dont get it.

 

Any ideas? 

 

Kind Regards,

Timm

1 answer

1 accepted

Okay I have a small update: I found out that if a open ticket is linked in a closed ticket, this will be still displayed via api.

 

Any Ideas how to fix that?

i also changed my query to:

 

text ~ "XYZ1*" AND status != Closed
https://RUNJIRAURL.com/rest/api/2/search?jql=text%20~%20%22XYZ1*%22%20AND%20status%20!%3D%20Closed

Have found another solution.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Jira

We want to hear from you! How do you use Slack and Atlassian together?

Hi Everyone! My name is Mina and I am on Atlassian’s Ecosystems Marketing team. Our team is focused on our technology partnerships and marketplace apps. One of Atlassian’s partners is Slack, who ...

85 views 1 5
Join discussion

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you