Forums

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

JQL does not return expected results

nubunto
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!
May 9, 2022

I am using OAuth 2 to connect to the Jira API. I have followed the documentation. The authentication and API calls go through, but when running a search query, I see no results.

reqBody, _ := json.Marshal(map[string]interface{}{
"expand": []string{"names"},
"jql": `text ~ ` + request.Query + ` order by created DESC`,
})


u := jiraAPIBaseURL + "/ex/jira/" + resource.ID + "/rest/api/3/search"

req, err := http.NewRequest(http.MethodPost, u, bytes.NewReader(reqBody))

 

The `resource.ID` is obtained through the call to `/oauth/token/accessible-resources`, as instructed in the documentation.

I have a project set up with two cards, but the result set is empty:

~
❯ curl localhost:8080/search/jira -d '{"query": "Lasagna"}'
{"results":{"issues":[],"maxResults":50,"startAt":0,"total":0}}

 

Raw request:

{"expand":["names"],"jql":"text ~ Lasagna order by created DESC"}

 

But the same JQL returns results in advanced search in my account:

 Screenshot 2022-05-09 094803.png

1 answer

1 accepted

0 votes
Answer accepted
nubunto
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!
May 9, 2022

Figured it out: the call was missing the Access Token.

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, team ’25 europe, early bird extension, conference discount, barcelona, hybrid event, AI teamwork, early bird pass, digital access, collaboration conference, atlassian events, register now, developer conference

1 week left to save on your Team '25 Europe pass

Still thinking about joining us for Team '25 Europe? Early bird has been extended for just one week! Now’s the time to lock in your lowest rate. Use code TEU25COMM-20 to save 20% at checkout. Hurry, this only lasts for 1 more week.

Learn more
AUG Leaders

Atlassian Community Events