REST Client get all issues of project

Hey there,

I want to get all issue keys of a project via Rest. Is there any method for that?

In the api I do not find any method there for.

6 answers

1 accepted

This widget could not be displayed.

hi.

you can trigger all issus of a project just like a jql query...

find more details here

http://docs.atlassian.com/jira/REST/latest/

Hi C. Faysal,

/rest/api/2/search?jql=project="Your Project Key"

This gives you just first 50 issues, how can i get all the issues? I have around 1348

Same problem here. Do I have to make two calls in order to get all issues?

If you check the docs, you’ll see information about the “maxResults” parameter to the “/rest/api/2/search” resource. That’s what you want.

This is everything I could find regarding "maxResults": "the maximum number of issues to return (defaults to 50). The maximum allowable value is dictated by the JIRA property 'jira.search.views.default.max'. If you specify a value that is higher than this number, your search results will be truncated."

The problem is, that you may not know how many there are before doing the query. And setting the value to some randomly high number feels wrong. I really don't know why it has to be that complicated. Why is the default 50 and not 'all'?

For everyone who has the same issue: Just use -1 as value for maxResults. That 'somehow' works.

Yeah, that’s how “maxResults” works. You don’t put in how many results you think you’ll get. You put in how many results you can possibly handle. It’s like a paged display of results. If you go to Google and search for “baseball,” Google won’t send over all 500,000,000 results that it knows about.

Obviously, whatever Jira instance you’re dealing with is a lot smaller than Google, so maybe whatever is gathering the results of your REST call can deal with all the results Jira can throw at you. In this case, setting “maxResults” to an arbitrarily high number, or the special value of -1 is the correct thing to do. That’s how it works.

Hi. anyone successful to get the issues no exceed 50 by using vba? can share the coding here? 

maxResult attribute helps only until 1000 issues.

Is there anything that can help get beyond this limit?

This widget could not be displayed.

This is everything I could find regarding "maxResults": the maximum number of issues to return (defaults to 50). The maximum allowable value is dictated by the JIRA property 'jira.search.views.default.max'. If you specify a value that is higher than this number, your search results will be truncated.

The problem is, that you may not know how many there are before doing the query. And setting the value to some randomly high number feels wrong. I really don't know why it has to be that complicated. Why is the default 50 and not 'all'?

For everyone who has the same issue: Just use -1 as value for maxResults. That 'somehow' works.

This widget could not be displayed.

some requests as:

/rest/api/2/search?jql=project="Your Project Key"&startAt="start"&maxResults="max"

where max limit is 1000. If you try a number greather than 1000 rest api returns only 1000 results.
You must to look "total" param in response to know how many request have to do.

FYI look at pagination section: https://docs.atlassian.com/jira/REST/latest/

Regards

I tried with "/rest/api/2/search?jql=project" and works.

However for entire string like /rest/api/2/search?jql=project="Your Project Key"&startAt="start"&maxResults="max" , 404 not found error is returned.

I am using JIRA 6.2. Is it not supported?

Please provide space before and after '&'
rest/api/2/search?jql=project="Your Project Key" & startAt="start" & maxResults="max"

This widget could not be displayed.

Hi All,

  What doe the APIs look like if I want:

1 - Get all the sprint IDs of a project?

2 - Get all the issues in a specific sprint?

I'm new to the API syntax and looks like the API docs did not explain the syntax well.  I'm continue to loop at the API doc and its API examples while waiting for some good tips.

Thanks a lot guys

J.N

I found the example page where it describes how to do all these.

Thanks anyway folks

J.N

Would you like to share this example page maybe @John Nguyen ?

This widget could not be displayed.

I have the same issue with worklogs, I can not get more than the first 20, 

I tried all the parameters specified in the Jira pagination spec, ex:

/issue/GPIM-7136?fields=worklog&startAt=15
/issue/GPIM-7136?fields=worklog&maxResults=10
/issue/GPIM-7136?maxResults=10

I am always getting back 

"fields": {
"worklog": {
"startAt": 0,
"maxResults": 20,
"total": 43,

 

This widget could not be displayed.

So there are two things one has to do..

  1.  Get the total issues in a project with a basic and 'quick and light' query
    1. I say light and quick because we are simply establishing the total count of issues in the project in this step.
    2. URL: https://<server>/rest/api/2/search?jql=project=<YourProjectKey>&maxResults=0
    3. This gives a result like --> 
      { "startAt": 0,
        "maxResults": 0,
        "total": 22114,
        "issues": [] }
  2. Iterate over the total number of issues to fetch the desired details/fields of each issue.
    1. Note: Maximum allowable fetch seems to be 1000 issues at a time. So let's break it up for iteration using the parameters startAt and maxResults.
    2. startAt is the index of the issue in the 'complete list (22114 items as above)'
    3. We can also filter the fields that we are interested to fetch. This is especially useful because failing to provide this will result in fetching all fields in each issue, including custom fields. Down below, I'm interested only in key, summary and description fields. 
    4. for startIndex in range(0, 22114, 1000): 

      search on URL: "https://<server>/rest/api/2/search?jql=project=<YourProjectKey>&fields=key,summary,description&maxResults=1000&startAt={startIndex}"

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Aug 06, 2018 in Jira Service Desk

A is for Activate: Share your top Jira Service Desk onboarding tips for new users!

Hi, everyone! Molly here from the Jira Service Desk Product Marketing Team :).  In the spirit of this month's  august-challenge, we're sourcing stories of Jira Service Desk activation fro...

578 views 25 15
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you