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:
- Test the same request via an API test tool like Postman, to eliminate a possible CURL fault.
- Change the JQL and test against other project keys to see if other projects are affected.
- 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.
- 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.
- Check that nobody has turned on Issue level security in that project, since that will block access at the issue level.
- Test the raw JQL statement directly in Jira itself to see what issues are found for the project with that key.
- 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