API search always returns 0 results

Jason Bosen December 28, 2021

I'm trying to get the results of a saved JQL filter via api. I've done this before in the past, so I believe I have the API call generally correct, and I get a 200 in response, but I always get this response: {"startAt":0,"maxResults":50,"total":0,"issues":[]}

There should be 39 results, that's what I see in the UI when I go to that filter. The saved query I'm passing in the JQL has 39 results. 

Here is the curl:

curl --location --request GET 'https://MY_INSTANCE_NAME_HERE/rest/api/2/search' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer MY_TOKEN_HERE' \
--data-raw '{"jql":"filter = 10236",
"fields":["key","issuetype","status"]}'
I have tried putting the JQL in instead of calling the filter directly and I get the same results. 
I use Jira Cloud. 

2 answers

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.
December 31, 2021

Is the token encoded in base64 as your email + api token or is it just simply your api token that's there?

0 votes
Fabio Racobaldo _Herzum_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 29, 2021

Hi @Jason Bosen ,

are u sure that the token is related to the user that see 39 issues as result?

Fabio

Jason Bosen December 29, 2021

Positive. I've used that token to create JIRA issues and the creator shows us as the same user I'm viewing the filter with.

Fabio Racobaldo _Herzum_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 29, 2021

Please check that the filter used in your rest api call is shared with the user.

Regards,

Fabio

Jason Bosen December 30, 2021

The filter is shared with all users in my organization. Additionally, my user created the filter and I am using my user's token. So I don't see how it could be a permission issue. 

Suggest an answer

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

Atlassian Community Events