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.
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/
f.e.
/rest/api/2/search?jql=project="Your Project Key"
https://developer.atlassian.com/display/JIRADEV/JIRA+REST+API+Example+-+Query+issues
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Same problem here. Do I have to make two calls in order to get all issues?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
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.
Hi. anyone successful to get the issues no exceed 50 by using vba? can share the coding here?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
maxResult attribute helps only until 1000 issues.
Is there anything that can help get beyond this limit?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
function jira_pagination () {
maxResults=50
total_items=$1
if [ 0 -lt $(expr $total_items % $maxResults) ]; then
total_iterations=$(expr $total_items / $maxResults)
else
total_iterations=$(expr $total_items / $maxResults)
fi
count=0
start_at=0
results=""
while [ $count -le $total_iterations ]
do
results+=$(${@:2}&startAt=$start_at)
start_at=$(( $start_at + $maxResults ))
count=$(( $count + 1 ))
done
echo "${results}"
}
function jira_get_all_issues_in_project() {
project_key="${1}"
number_of_total_boards=$(curl -s -u ''$JIRA_USERNAME:$JIRA_PASSWORD'' -X GET -H "Content-Type: application/json" https://jira.com/rest/api/2/search?jql=project="${project_key}" | jq .total)
issue_results=$(jira_pagination $number_of_total_boards curl -s -u ''$JIRA_USERNAME:$JIRA_PASSWORD'' -X GET -H "Content-Type: application/json" https://jira.com/rest/api/2/search?jql=project="${project_key}")
echo "${issue_results}"
}
jira_get_all_issues_in_project "someproject"
If anyone is still looking for a solution. You can use the following bash functions to get a list of all the issues. It will iterate over all the pages and in the end give you all the issues in a project. It will be slow depending upon how many issues are there. Change the jira server and pass the project.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
So there are two things one has to do..
URL: https://<server>/rest/api/2/search?jql=project=<YourProjectKey>&maxResults=0
{ "startAt": 0,
"maxResults": 0,
"total": 22114,
"issues": [] }
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}"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This should be the top answer IMO. Thanks a lot!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The real MVP
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
When i use this,
search on URL: "https://<server>/rest/api/2/search?jql=project=<YourProjectKey>&fields=key,summary,description&maxResults=1000&startAt={startIndex}"
I got 100 issues, unlike before I only have 50, but I want more than hundreds of issues
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Jowin Cueto , what is your start index? Did you try running your query inside Jira environment to verify how many issues it returns? We would simply need to provide the same query to the "jql" parameter.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Specify maxResults=None, This worked for me.
I was able to get all the results from jira.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
just sharing my resolution to the concatenation of results , and getting all the info
i have a jira query function in perl
, which is called for every jql i need and return a ref to all the issues that come back
so i am calling the function as follow :
defining the max results jira allows to retrieve:
use constant {
JIRA_MAX_RESULTS => 1000,
};
initialize my jql :
my $jira_Jql = 'project = "GIGI" and type in ("Bug" , "Minor Bug") ';
define which return columns I need (instead of getting big hash back this will narrow it a bit ) :
my $returnedColumns = [ qw/key/ ];
or another example to get key + status :
my $returnedColumns = [ qw/key status/ ];
and I call the function :
my $jiraResultsRef = queryJira($jira_Jql, $returnedColumns);
:the function itself looks as below and iterate via the results
first it run the jql with maxresults = 0 to get the number of results which exist,
then based on that it initializes the amount of iterations need to do in order to get all the info .
last stage is to concatenate the results and returning the ref to this array .
use JIRA::REST;
sub queryJira { my ($jira_Jql, $returnedColumns) = @_;
# set Connection to the jira API.
$_jiraUrl = "http://$_jira_host:$_jira_port";
$_jiraConnection = JIRA::REST->new({
url => $_jiraUrl,
username => $_jira_user,
password => $_jira_pass,
});
# return search total number of results
my $queryTotalOfResults = $_jiraConnection->POST('/search', undef,
{
jql => $jira_Jql,
startAt => 0,
maxResults => 0,
fields => $returnedColumns,
});
#check the amount of issues returned :
my $totalResultsNumber = $queryTotalOfResults->{total};
# dividing the number with the jira's MAX results which are allowed via "ceil" which will give the number of iteration needed
my $numberOfIterations = ceil ($totalResultsNumber / JIRA_MAX_RESULTS) ;
print ("\n \$totalResultsNumber: $totalResultsNumber \n \$numberOfIterations : $numberOfIterations \n\n");
my $queryResults;
my @_returnedResults ;
if (not $totalResultsNumber) #if no results found
{
return;
}
#assuming there are result start looping :
for(my $counter=0; $counter <= $numberOfIterations; $counter++)
{
$queryResults = $_jiraConnection->POST('/search', undef,
{
jql => $jira_Jql,
startAt => ($counter*JIRA_MAX_RESULTS),
maxResults => JIRA_MAX_RESULTS,
fields => $returnedColumns,
});
#and concatenate them to one big happy @_returnedResults
@_returnedResults = ( @_returnedResults, @{$queryResults->{issues}} );
}
# making sure i got the same amount of keys returned :
print ("\n total of keys in the hash :" . (scalar @_returnedResults) . "\n" );
return \@_returnedResults;
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorted, found this dedicated question https://community.atlassian.com/t5/Jira-questions/How-to-get-list-of-worklogs-through-JIRA-REST-API/qaq-p/533633.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I found the example page where it describes how to do all these.
Thanks anyway folks
J.N
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Would you like to share this example page maybe @John Nguyen ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The info is on this page:
Hope it helps.
J.N
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please provide space before and after '&'
rest/api/2/search?jql=project="Your Project Key" & startAt="start" & maxResults="max"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.