Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

crucible indexing performance by restapi

Dhandapani subramani June 12, 2013

Hi , we've added 1000+ repositories in crucible . 95% of repositories status shows "Awiting poll" (I've installed new crucible version ), I want to check the indexing status using curl or wget method to hit the crucible URL

Please share me your idea about how to verify the indexing status or initial indexing performance using curl or wget from Crucible server

Thanks

Dhandapani

2 answers

0 votes
Dhandapani subramani June 13, 2013

Hi Renjith

I am using this REST API call, I am trying to find my mistake here.

I am getting this error

REST::Client exception: headers must be presented as a hashref at test.pl line 48

use REST::Client;
use JSON;
use Data::Dumper;
use MIME::Base64;
use LWP::UserAgent;
use LWP::Simple;
use XML::Parser;
use XML::Twig;
use HTTP::Request::Common qw(GET);
my $tokenpath = "/tmp/token";
my $token = `/bin/cat $tokenpath`;
chomp $token;
my $client = REST::Client->new();

my $lwp_client = LWP::UserAgent->new;
$client->setHost('http://host:8060');


my $headers = { "Accept" => 'application/xml', "Content-Type" => 'application/xml', "Authorization" => 'Basic ' };

##############################################################################
my $xml = new XML::Simple;
my $url = 'http://host:8060/rest-service-fe/repositories-v1';
my $request = HTTP::Request->new(GET => $url);
$request->content_type("application/xml");
my $patch = <<EOF;
<repositoryList>
<repository repositoryState="RUNNING" name="project" finishedFullSlurp="true" enabled="true"/>
<repository repositoryState="STOPPED" name="project" finishedFullSlurp="true" enabled="false"/>
</repositoryList>
EOF

my $headers = {"Accept" =>'application/xml', "Content-Type" => 'application/xml', "Authorization" =>'Basic '};
my $responseContent = $client->GET('/rest-service-fe/repositories-v1/?FEAUTH='.$token, $patch, $headers);
print $client->responseContent();

0 votes
Renjith Pillai
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 12, 2013

Try using the REST interface explained at https://docs.atlassian.com/fisheye-crucible/latest/wadl/fisheye.html#d2e89

You may be able to use the finishedFullSlurp or repositoryState to find this information.

Dhandapani subramani June 12, 2013

thanks Renjith, I am using this restapi call, but I receive error below .

my $token = "user:bccd9907f6654ba1bfd49e428eadd4485e096c";
my $client = REST::Client->new();
my $lwp_client = LWP::UserAgent->new;
$client->setHost('http://host:8060');

##############################################################################
my $xml = new XML::Simple;
my $url = 'http://host:8060/rest-service-fe/repositories-v1';
my $request = HTTP::Request->new(POST => $url);
$request->content_type("application/xml");
my $patch = <<EOF;
<repositoryList>
<repository repositoryState="RUNNING" name="project" finishedFullSlurp="true" enabled="true"/>
<repository repositoryState="STOPPED" name="project" finishedFullSlurp="true" enabled="false"/>
</repositoryList>
EOF

my $headers = {"Accept" =>'application/xml', "Content-Type" => 'application/xml', "Authorization" =>'Basic '};
#my $responseContent = $client->POST('/rest-service/reviews-v1/?FEAUTH='.$token, $patch, $headers);
my $responseContent = $client->POST('/rest-service/reviews-v1/?FEAUTH=',$patch, $headers);
print $client->responseContent();

But I am receiving this error, I am using valid token only. I am able to create reviews and add patch using my token. but the above query only report this below error.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><status><status-code>401</status-code><message>The login token provided is invalid</message></status>

I

Renjith Pillai
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 12, 2013

Hold on a sec. I thought you want to get data of the respository status. Why are you Posting data to the REST interface then? You should just do a GET of the interface. And pass FEAUTH as a query parameter. (check https://answers.atlassian.com/questions/66167/token-login-with-fisheye-crucible-not-working-for-rest-request)

Dhandapani subramani June 12, 2013

I've used curl , its working , but output format is not clear , the list is more than 1000+ repositoires. All are printing at same line.

my $cmd_exec = system("curl --cookie remember=$token -X GET http://host:8060/rest-service-fe/repositories-v1");

If I use rest api call, it doesn't work. I've added URL and header informtion.

REST::Client exception: headers must be presented as a hashref at test.pl line 49

Renjith Pillai
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 12, 2013

In curl you are storing the session cookie and then using it. While using the API as I said, pass the token as GET query parameter FEAUTH. Try it out in a browser Dhandapani. Use this for a nice output in Chrome

https://chrome.google.com/webstore/detail/rest-console/cokgbflfommojglbmbpenpphppikmonn?hl=en

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events