How to get all issues of a project using Rest API

rahul saini
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 28, 2018

Hi,

I'm working on a project to retrieve some info from JIRA using it's Rest APIs.

I just have project name with me. Requirements are:

1. How to get project key from only project name?

2. How to fetch all the unresolved issues of that project?

I went through REST documentation, but did not find much.

 

As you might have guessed I'm new to Jira.

So, please suggest.

 

Thank You

 

2 answers

1 accepted

11 votes
Answer accepted
Prashant Mali
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.
June 28, 2018

HI @rahul saini ,

Below API will help to get issues of particular project

/rest/api/2/search?jql=project=ABC&maxResults=1000

where

ABC=Project Name

1000= maximum 1000 can see in one JSON file.

rahul saini
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 28, 2018

Thanks, but how can I filter on the basis of resolved/unresolved?

Prashant Mali
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.
June 28, 2018

Hi @rahul saini ,

You can adjust your jql query in above API. I just used Project=ABC like wise you can add other conditions too.

Thanks,

Prashant

avenger s
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 9, 2019

hi ,

Can we add multiple projects over here to get different project's issue list.

avenger s
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 6, 2020

How to provide pagination for this query? I have more than 3000 records, but i'm getting only 1000 by using maxresults.

Jogin Joy April 24, 2020

the /rest/api/latest/search gives back a response you could use for pagination by default. For instance, the response will look something like the following:

{ 

"startAt"0,                   // tells you from where JIRA started looking for you

"maxResults"50,        // how many it sent you in this response

"total"5000,               // how many it actually has in total

"issues": [0...49]         // the 50 issues(maxResults) you asked for

}

 

In the next request you could then send the param startAt=startAt+maxResult (0+50, in this case) which will then return

{ 

"startAt"50,

"maxResults"50,

"total"5000,

"issues": [50...99]

}

On a side note, if you give maxResults=-1 JIRA will provide you as many results as it can, depending on what's configured on your JIRA instance by the admin

 

And, yes you can get results for multiple issues. Just give project in (p1, "p2 new") etc

project is not empty give all issues in all projects

Note that the double quotes are needed if the project name has multiple words with space in between. Also while using double quotes you might need to consider encoding or escaping it based on what client or programming language you are using to test the request

 

Hope this helps

Like LUCAS FRANKLIN SILVA likes this
Prashant.Khadatkar
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 5, 2020

Hi, I tried  project in (p1, "p2 new")  to get issue data for multiple project but getting error "(400): Bad Request".

Like Piotr Poliwoda likes this
S
Contributor
July 27, 2021

@Jogin Joy While your suggested approach is a good start... but it doesn't guarantee a sequential result i.e. you can start from 0 and then 0+50 and so on.. but this 0, 50 is not co related to Jira key...

I stumbled since I'm having same question...

Ashwani Garg November 17, 2021

In Laravel, this could be done like this.

 

$url = env('JIRA_HOST').'/rest/api/3/search?jql=project=WIJ&maxResults=1000';
$response = Http::withBasicAuth(env('JIRA_USER'), env('JIRA_PASS'))->get($url);
return response()->json($response->json());
Ali Balbars
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 4, 2022

it worked for me, thank you

2 votes
Sana Safai
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.
June 28, 2018

Hi there,

You probably need to get all projects (/rest/api/2/project) and then parse your result and find the project that matches your project name.

Suggest an answer

Log in or Sign up to answer