Hi everyone,
You can use the REST API in Jira to return all issues, in this case, it would probably be best to use the endpoint GET /rest/api/2/search - Jira Server (for Cloud GET /rest/api/3/search)
In this case, you can just make a rest call to this endpoint, if you don't specify any JQL parameter here, it's the same as if you searched in the issue navigator in Jira and left the advanced search field empty; it returns all the issues that this user has access to.
Cloud example using curl
curl --request GET \
--url '/rest/api/3/search' \
--header 'Authorization: Bearer ' \
--header 'Accept: application/json'
Server example using curl
curl -D- -u username:password -X GET \
-H "Content-Type: application/json" \
"http://localhost:7123/rest/api/2/search?jql="
For other users that come across this, I hope this helps.
Regards,
Andy
This method without any filter is returning only 50 maxresults.. How to get all issues for a particular project?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Very simple, folks!!
Just run https://xxxx.atlassian.net/rest/api/2/search?jql= in your browser!! That's all!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This worked and brought all issues for all projects!! Thank you so much!!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Some Jira sites will not return all issues when you use a blank JQL query. But then again some will. It has become an administrator setting that can be helpful to improve overall performance. Instead of using that query, try to at least enter something in the JQL, such as 'Order by created'
https://[yoursitename].atlassian.net/rest/api/2/search?jql=ORDER%20BY%20Created
Which should work on any Jira site regardless of that setting.
If you still get back 0 results, then either there are no issues there, or your account is not authenticated, or the account you have authenticated with cannot see any issues yet.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
https://[yoursitename].atlassian.net/rest/api/2/search?jql=ORDER%20BY%20Created
didn't work... it returns only 50 records at a time... is there a server setting that can be enabled or toggled with ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @S
Check out https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-search/#api-rest-api-3-search-get it explains that there is a query parameter there called maxResults that defaults to 50. You can try to increase the maxResults with a query such as
https://[yoursitename].atlassian.net/rest/api/2/search?jql=ORDER%20BY%20Created&maxResults=100
However there is a note there about this:
To manage page size, Jira may return fewer items per page where a large number of fields are requested. The greatest number of items returned per page is achieved when requesting
id
orkey
only.
For Jira Cloud there is no administrator setting that you can enable or toggle to default this to the complete results. If this is a problem, try using the startAt parameter instead and break this up into multiple queries, such as
Query 1
https://[yoursitename].atlassian.net/rest/api/2/search?jql=ORDER%20BY%20Created&maxResults=50&startAt=0
Query 2
https://[yoursitename].atlassian.net/rest/api/2/search?jql=ORDER%20BY%20Created&maxResults=50&startAt=50
Query 3
https://[yoursitename].atlassian.net/rest/api/2/search?jql=ORDER%20BY%20Created&maxResults=50&startAt=100
and so on. This is explained as pagination, and it is used to improve overall performance, as previously getting a complete list in a single call tends to be a pretty strenuous task.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks @Andy Heinzer For me its defaulting to 50, no matter what I try.
I feels like there's a default login on the size of data returned....
what I have tried so far
I'm using Jira Service Management Cloud
https://XXXX.atlassian.net//rest/api/2/search?jql=ORDER%20BY%20Created&maxResults=500&startAt=0
https://xxxxx.atlassian.net//rest/api/2/search?jql=ORDER%20BY%20Created
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Same here. At max I could get 100 records, some say its possible, some say not. Can anyone conclude this to avoid confusion once in for all whether really its possible to fetch all issues? If not we can just move on then trying and wasting more time here.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Andy Heinzer ,
I'm struggling with getting no results even with for example:
https://******.atlassian.net/rest/api/2/search?jql=ORDER%20BY%20Created
If you still get back 0 results, then either there are no issues there,...
There are definitely issues there. When I paste that line into the browser, it shows all the issues.
...or your account is not authenticated, or the account you have authenticated with cannot see any issues yet.
I'm using the one account that exists for my JIRA Software instance. I'm using the basic authentication method for API calls.
I had a hard time making it work due to the Cors issue. Then I finally managed to make i work using http-proxy-middleware. Now the calls are getting through but like I said, with 0 results.
Any idea?
Thank you, sir.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Since the REST API endpoint for search is accessible anonymously, if you were to supply the credentials incorrectly in your REST API call, Jira would still just tell you there are 0 results rather than tell you that your credentials are incorrect or invalid.
Try calling another REST API endpoint such as GET /rest/api/3/issues/{issueIdOrKey}. And call a specific issue that you know your account can see. If you can get back that issue details (such as a json response that contains issue fields like description, summary, etc) and this issue is not open to the public (meaning anonymous users can't view it), then this is another way to test out if your REST API authentication is working as you expect.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Manthan Patel and @S Did you figure out a way to pull more that 100 issues in the JQL search API?
I have a requirement where i need to loop through all the tickets in the filter and update a filed. All I can do now is to set maxResult=100 and looping through the issues. but the filter has about 300 issues and may increase in future.
I tried using maxResult = 300 but it is still giving me only a maximum of 100 issues and the script I wrote is only updating the 100 issues. Please help
Thanks, Sainath
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This anwser is incorrect, atleast in API v3 there doesn't seem to be any way to do this, there's no "search" api that I can see, can someone please post a link to the actual part of the documentation where you can do this?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There is still a search endpoint you can use, even in Jira Cloud v3 of the REST API. I have linked to the reference guide in my original answer.
(for Cloud GET /rest/api/3/search)
This is still accurate for Jira Cloud today. Please let me know if you run into any problems with this.
Andy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I might have been unclear, sure there's a search, but what you get is a list of issueids, not the actual issues.
If we were to download all issues in a jira instance it would take hours to loop through every id and make an API-call.
Add to that making extra calls per issue to get all the fields for each issue.
Why isn't there a quicker get-all-issues feature? why have to loop through every single one "by hand".
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Gabriel,
Thanks for clarifying. The documentation of the search endpoint note that:
Note: All navigable fields are returned by default. This differs from GET issue where the default is all fields.
Have you tried to use the query parameters in that endpoint GET /rest/api/3/search such as fields=*all ? This will let you not only return the issues in the search, but all the fields of those issues as well. Perhaps this is the missing piece you are looking for.
So yes, you could use the GET issue endpoint and loop through it to get all the issues, but I think using an empty JQL search that returns all issues your account can view would probably be easier to accomplish in a single call. And you can get back all the fields if you pass it the right parameters. You might also want to use the expand=names in order to see the names of all those custom fields in the results.
I suspect here is not a get-all-issues type endpoint because the search endpoint can be made to perform this same function depending on the parameters passed to it.
Does that help more than the previous answers here? Please let me know,
Andy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am executing issues api to get issues against a jql. Jira ui is showing issue count is 4890 but getting 4679 as unique records via rest api.
Can somebody please help me , why i am getting duplicate keys in jira rest response.
Is there any plugin creating a problem or cloning an issue is causing this delicacy.
Appreciate urgent help.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Yuvam Jain There are a few different possible scenarios that can account for this here. But they vary depending on your platform for Jira (Server, Data Center, or Cloud).
The most common answer is that you're using a different account in REST API than you are in the web interface. JQL searches are user dependent. Meaning different users can run the same JQL and get back different results depending on which issues they have permissions to see (technically you need both permissions AND issue level security in order to see an issue).
If you're using the same account, then there are other possible causes here, such as the syntax of the JQL, or indications of an indexing problem in Jira, or even possibly stale replications between data center nodes (last one only applies to data center).
If you were in Server or Data Center, you could query the SQL database directly to find the issue count with a SQL query of:
select count(*) from jiraissue;
This returns the total number of issues regardless of your Jira permissions to see them.
If you're using Jira Cloud, then you might want to reach out to your site-admin to first figure out if there is a difference between your account and the one you're using for the REST API call here. If not, then perhaps your site-admin can create a support case with Atlassian in order to investigate the details of your Jira issue data here further.
Andy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Andy Heinzer ,
I’m Using a Forge App, I tried by using the JQL search to find all issues for a particular project:
But throws a error “OAuth 2.0 is not enable for the method”
Any other solution to overcome this error?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
When using a Forge app, you will need to include the specific endpoint scopes. See also https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#forge-apps
For Forge apps, REST API scopes are used when authenticating with Jira Cloud platform. See Add scopes to call an Atlassian REST API for more details.
The URIs for Forge app REST API calls have this structure:
/rest/api/3/<resource-name>
For example,
/rest/api/3/issue/DEMO-1
For you to see that particular error indicates that the forge app does not have that scope yet.
Has the details of which scopes are required for that endpoint:
OAuth 2.0 scopes required:Classic RECOMMENDEDread:jira-work
Granular:read:issue-details:jira
Those scopes would need to exist in the forge app for it to be able to make this kind of search using that endpoint.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for the reply,
I tried by using this documentation to get all issues for a particular project in my app https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-search/#api-rest-api-3-search-get
When trying to GET to /rest/api/3/search?jql=project=SLM"
and ending up with an Error: OAuth 2.0 is not enabled for this method
I used the Classic Scopes in my manifest.yml file that you mentioned above
read:jira-work
read:issue-details:jira
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you updated the manifest, you do still need to upgrade the app for these scope changes to take affect. More details in https://developer.atlassian.com/platform/forge/add-scopes-to-call-an-atlassian-rest-api/
If that doesn't help, you might want to reach out within our developer community over in https://community.developer.atlassian.com/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Andy Heinzer I do not believe I have seen a true answer for this thread.
The problem to solve is how to GET ALL issues from a Project in either Jira software or JSM using the Rest API.
When I try, I get a maxResults of 100 even when I set maxResults to 1000 or more. I have 15,000 issues in the project and want to return all of them, not just 100.
Is this not possible?
This is the url I am using:
https://mydomain.atlassian.net/rest/api/2/search?jql=project=1234 order by key&maxResults=15000
From this, I get 100 rows of data, not 15000, not 101.. Just 100.
Does anyone know how to resolve this?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
15000 issues is a lot of data to return in a single call. I don't believe it's possible to do in a single call. That much data can put a significant overhead on the service. Because of that, the REST API is designed to limit the maxresults to an upper limit. This is a means to protect the service from being overwhelmed. Please check out https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#pagination
With the given results of only 100 issues, this kind of REST call would require 150 calls using a maxResults=100 an then using the startAt=0 parameter. You would then need to increment that startAt by 100 for each call. That way you could return all the search results for a large set of issues, albeit by making several REST API calls.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Duplicate
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Tarun,
I am new to this could you please provide me rest api
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
See the link in the question Tarun referenced.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
"Duplicate" link does not provide the answer.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That page explains how to get a list of issues over the REST API and exposes the other docs on REST.
That definitely answers the question.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry, you are definitely right.
I just wanted to remark how I was brought here from google search.
This page has the more concise answer.
Sorry for not having explained myself.
M.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.