crucible indexing performance by restapi
Asked by Dhandapani subramani:

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


Answers:
author: Dhandapani subramani
body: 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');  

<br />

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();


author: Renjith Pillai
body: 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.

comments: author: Dhandapani subramani
body: 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


author: Renjith Pillai
body: 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](/questions/66167/token-login-with-fisheye-crucible-not-working-for-rest-request))


author: Dhandapani subramani
body: 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");](http://host:8060/rest-service-fe/repositories-v1%22%29;)

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


author: Renjith Pillai
body: 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>


Tags: index