Forums

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

jira api: how to search issues for strings in project

Dennis Chin
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!
March 31, 2020

Hello I am trying to search for a strings within my project using the REST api but can't really understand the doc... For example I want to search for issues in the project CO and the summary must contain *test ssl*. Im expecting some payload that shows last updated etc..

1 answer

0 votes
Daniel Ebers
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.
March 31, 2020

Hi Dennis,
welcome to Atlassian Community.

You are on the right track.

Which section of the documentation is unclear to you?
Based on this example section you will have to adjust the jql= part to query for what you are searching (for example the summary).

The response then should be similar to the one in the example section.

Cheers,
Daniel

Dennis Chin
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!
March 31, 2020

So looking at the example :

 

curl \ -D- \ -u admin:admin \ -X POST \ -H "Content-Type: application/json" \ --data '{"jql":"project = QA","startAt":0,"maxResults":2,"fields":["summary","key"]}' \ "http://localhost:8080/rest/api/2/search"

 

But let's say I wanted to search for the string "test ssl" in the  summary how would I do it?

Daniel Ebers
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.
March 31, 2020

It should be not more complicated like this:

POST: /rest/api/2/search

body: 

{

jql: "project = TEST And summary = example",

maxResults: 1000,

startAt:1000

}

Cheers,
Daniel

Jan-Willem Aikens July 5, 2021

Hi @Daniel Ebers

I'm having issues with this as well.

I'm trying to post a jql query. This works --data line is important here:

curl -D- \   
-u PERSONAL_DATA_REMOVED \
   
-X POST \
   
-H 
"Content-Type: application/json" \  
 --data '{"jql":"summary~\"Testing\"","startAt":0,"maxResults":50,"fields":["id","key"]}' \ 
"https://localhost:8080/rest/api/2/search"

But when I replace the data with this it does not (it returns no results. I know for a fact there is an issue containing it:

  --data '{"jql":"summary~\"Testing mail for user: mail@domain.com 2021-07-05\"","startAt":0,"maxResults":50,"fields":["id","key"]}' \  

Could you please advise?
Thanks very much.

Jan-Willem.

Daniel Ebers
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.
July 11, 2021

Hi @Jan-Willem Aikens

this looks good! I cannot spot any obvious mistake. Moreover I tested it with this Summary on my instance but it gave me back this very one issue - so I cannot figure out why it should not be working for you.
Is the user you are authentication with having permissions on this issue?
Can you open it through Jira itself (user interface) instead of API?

Regards,
Daniel

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, loom, loom for training, loom for teaching, video training, async learning, online education, screen recording, loom tutorials, loom use cases, atlassian learning, team training tools, instructional video, virtual training tools

🛗 Elevate Your Training and Enablement with Loom

Join us June 26, 11am PT for a webinar with Atlassian Champion Robert Hean & Loom’s Brittany Soinski. Hear tips, stories, and get your burning questions answered. Learn how Loom makes training and enablement easier. Don’t miss it!

Register today
AUG Leaders

Atlassian Community Events