Reindex jira via Rest API

When trying to initiate a jira re-index using rest via:


I receive the following:

A task could not be found for the given task id
Is this feature fully implemented and has anyone managed to get this working?

3 answers

1 accepted

Below is the perl code used to carry out a reindex (thought this may be helpful):

use strict;

use warnings;


use REST::Client;

use MIME::Base64;

use JSON;






sub main {

        my ($content, $subject);


        my $username = $ENV{JIRA_ADMIN_USER} || die "JIRA_ADMIN_USER env var not set";

        my $password = $ENV{JIRA_ADMIN_PASS} || die "JIRA_ADMIN_PASS env var not set";


        my $headers = {

                'X-Atlassian-Token' => 'nocheck',

                Authorization => 'Basic ' . encode_base64($username . ':' . $password)


        my $client = REST::Client->new();


        my $response = $client->POST('/rest/api/2/reindex', $content, $headers);


        if($response->{_res}->{_rc} != 202) {

                $subject = "Error running JIRA reindex on $JIRA_HOST return code $response-{_res}->{_rc} <EOM>";

        } else {

                my $current_progress = 0;

                while($current_progress != 100) {

                        my $response = $client->GET('/rest/api/2/reindex?taskId', $headers)->{_res};

                        my $content = JSON->new->utf8->decode($response->{_content});
$current_progress = $content->{currentProgress};

                        sleep 10;


                $subject = "JIRA weekly reindex has been completed for $JIRA_HOST <EOM>";





Are you doing a post there ? or a get ? AFAIK, you need to POST it

(edit) ... and be sure to have a user which have admin permission for reindex.

I'm doing this directly in the browser, I do have admin permissions.


As per our rest documentation you can do both GET and POST. Can you try to use the Google Chrome REST Console addon to do so as well?

Can you also try to run the REST command below?

Hope it helps!


Luciano Fagundes

As per your documentation, GET returns the status (if you have admin perms). POST is needed to start reindex, and this is what Paul tries to do. ;)

I needed to include empty content in the POST request so instead of this:

$client->POST('/rest/api/2/reindex?type=FOREGROUND', $headers);

I had to include:

$client->POST('/rest/api/2/reindex?type=FOREGROUND', $content, $headers);

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

2,880 views 12 18
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot