Jira API returns empty list when trying to search for issues

Using this documentation provided: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-search/#api-rest-api-3-search-id-post

I used the curl example and where the asterisks are located is where I put my information. So, in the API token, url domain, email, and project key.

curl --request POST \
  --url 'https://******.atlassian.net/rest/api/3/search/id' \
  --user '****@****.com:<api_token****>' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data '{
  "jql": "project = ***",
  "maxResults": 1000,
  "nextPageToken": "EgQIlMIC"
}'

I get this result: {"issueIds":[]} when run. Are there different nextPageTokens I am supposed to create? I have left the nextPage token empty as well and have gotten the same result. I have taken that entire line out and also have gotten the same result with an empty list.

Hello @LexCaldwell

That REST API endpoint is working exactly as documented for me.

Firstly, maxResults is 1,000 by default, so you don’t need to define it unless you want a smaller amount.

Next, you can’t ‘create’ the nextPageToken parameter, it is generated by Jira and returned in the response if there are more results in the dataset. The value “EgQIlMIC” on the documentation page is just an example.

Try just the most basic request body:

 --data '{
  "jql": "project = THEKEY"
}'

Lastly, are you getting a 200 response back or a 400 / 401 response? If a 200, are you sure that:

  • The project you’re querying actually has issues in it?
  • The user account you’re using has read permissions for that project?

I’m getting a 200 response but again just a empty list of:

{"issueIds":[]}

This result is with the nextPageToken and just using the basic request body provided above I got the same result of an empty list. The project I am querying actually has issues in it and I do have read permissions for this project. Are there other permissions I need to be able to access the information inside of my project?

It’s not clear what you mean by this statement. How is the result ‘with’ nextPageToken when the basic request body example I provided is without nextPageToken?? You don’t need that parameter for anything at this point in time.

Anyhow, I cannot replicate the endpoint fault under the circumstances you have described. The only way I can replicate that fault is if I provide a wrong or non-existent project key, so of course the JQL will find no matching project, so therefore no issues.

I would suggest you now follow the classic fault finding tests, such as:

  1. Test the same request via an API test tool like Postman, to eliminate a possible CURL fault.
  2. Change the JQL and test against other project keys to see if other projects are affected.
  3. Try the ‘classic’ Search for Issues using JQL endpoint to see if other endpoints return the issues for the project using the same project key.
  4. Try another user’s credentials to see if it is your user account at fault. Revoke your token and create a new one if required.
  5. Check that nobody has turned on Issue level security in that project, since that will block access at the issue level.
  6. Test the raw JQL statement directly in Jira itself to see what issues are found for the project with that key.
  7. Have a peer review your work and findings.

If, after performing all the required testing, you still can’t determine why that single endpoint won’t return the issue IDs for that project for that user, then you’ll need to raise a support ticket with Atlassian to delve deeper

1 Like