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

how to get limited response from FishEye API using curl

Mark Zusman December 25, 2014

I usually do quick prototypes of my work in shell, so I'm trying to get list of last 20 changesets in a repo

 

FEAUTH=`curl -s 
"${FECRU_HOST}/rest-service/auth-v1/login?userName=${FECRU_USER} 
password=${FECRU_PASSWORD}" | sed -e 's#^.*<token>##'  -e 
's#</token>.*$##'`

curl -v 
"${FECRU_HOST}/rest-service-fe/changeset-v1/listChangesets?FEAUTH=${FEAUTH}&rep=RT.control&expand=changesets&limit=20"

 

Without "limit=20" everything works as expected - I get about 6k changesets. After I've added "limit=20", I still get 6k responses; even more interesting, it's in XML, not in JSON - though my reading of https://docs.atlassian.com/fisheye-crucible/latest/wadl/fisheye.html is that as soon I specify "limit" parameter, I should be getting paged JSON. I've tried "application/json" as a header - didn't help.

What am I doing wrong?

 

 

 

 

4 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
Mark Zusman December 29, 2014

works perfectly! thanks a lot!

 

CSID=`curl -s -H"Accept: application/json" "${FECRU_HOST}/rest-service-fe/revisionData-v1/changesetList/RT.control?FEAUTH=${FEAUTH}&maxReturn=20" | sed -e 's/^.*\[//' -e 's/\].*$//' -e 's/"//g' -e 's/,/ /g'`
for c in $CSID
do
   curl -s -H"Accept: application/json" "${FECRU_HOST}/rest-service-fe/revisionData-v1/changeset/RT.control/${c}?FEAUTH=${FEAUTH}"
   printf "\n---------------------\n"
done
0 votes
Piotr Swiecicki
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 28, 2014

Hi Mark,

I'm afraid there is no limit parameter implemented for the endpoint you are using, see documentation page https://docs.atlassian.com/fisheye-crucible/3.6.0/wadl/fisheye.html#rest-service-fe:changeset-v1:listChangesets.  

You can use other endpoints though.  Take a look at https://docs.atlassian.com/fisheye-crucible/3.6.0/wadl/fisheye.html#rest-service-fe:revisionData-v1:changesetList:repository - that brings a list of changesets and response size can be limited with a maxReturn parameter.  It returns changeset ids only, but you can then make a separate call to https://docs.atlassian.com/fisheye-crucible/3.6.0/wadl/fisheye.html#rest-service-fe:revisionData-v1:changeset:repository:csid to retrieve full details of the particular changeset.

For instance:

Regarding response format, XML is returned by default, but you can easily request JSON response by either:

Hope that helps,

0 votes
Mark Zusman December 26, 2014

OK, no JSON then - can I somehow limit amount of output? 20 rows? 60 last days? Anything?

 

0 votes
Norman Abramovitz
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.
December 25, 2014

A paged REST API call is usually marked as one like on the following page. 

https://docs.atlassian.com/fisheye-crucible/latest/wadl/fecru.html

Your API call is not marked as a paged API. 

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events