It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to get all issues in jira using rest api?

I have one client requirement.could you please tell me how to get all issues in jira using rest api.

3 answers

1 accepted

1 vote
Answer accepted
Andy Heinzer Atlassian Team Apr 05, 2019

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

Hi Tarun,

I am new to this could you please provide me rest api

See the link in the question Tarun referenced.

"Duplicate" link does not provide the answer.

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.

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.

0 votes

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?

Andy Heinzer Atlassian Team May 27, 2020

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

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".

Andy Heinzer Atlassian Team May 28, 2020

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

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.

Andy Heinzer Atlassian Team Jul 22, 2020

@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

Like Nic Brough _Adaptavist_ likes this

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you