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

Fisheye REST API to get latest commits

J July 13, 2014

Hello,

I would like to iterate through a number of repos and their branches and determine if anything has been committed since a certain date/time.

I have been looking at the Fisheye REST API documentation but cannot figure out how to achieve this.

As a simple example (with 1 repo and 1 branch) if I have a repo called 'foo' and a branch called 'bar', how would I get back the CSID and timestamp of the most recent commit?

Thanks!

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Answer accepted
Piotr Swiecicki
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 13, 2014

Hi J,

Start from https://docs.atlassian.com/fisheye-crucible/latest/wadl/fisheye.html#rest-service-fe:revisionData-v1:changesetList:repository(/rest-service-fe/revisionData-v1/changesetList/{repository}?path=<value>&start=<value>&end=<value>&maxReturn=<value>) and https://docs.atlassian.com/fisheye-crucible/latest/wadl/fisheye.html#rest-service-fe:revisionData-v1:changeset:repository:csid(/rest-service-fe/revisionData-v1/changeset/{repository}/{csid}) endpoints. They should give you the data you are after.

For example, take a look at exist-git repository activity stream.
You can retrieve recent changesets by calling the first endpoint:

$ curl -sH 'Accept: application/json' https://fisheye3.atlassian.com/rest-service-fe/revisionData-v1/changesetList/exist-git?maxReturn=3 | python -mjson.tool
{
    "csid": [
        "7f1b9179b89b449218755f61033085092d2947fb",
        "0da9e236196862f0d5cf847382583d2761c96f92",
        "c2c778863e18bad3cc761611135f5f63883b0313"
    ],
    "resultsTruncated": true
}

Then you can retrieve more information on the earliest changeset by calling second endpoint:

$ curl -sH 'Accept: application/json' https://fisheye3.atlassian.com/rest-service-fe/revisionData-v1/changeset/exist-git/7f1b9179b89b449218755f61033085092d2947fb | python -mjson.tool
{
    "author": "Dannes Wessels &lt;dizzzz@users.noreply.github.com&gt;",
    "branch": "develop",
    "branches": [
        "develop"
    ],
    "children": [],
    "comment": "Merge pull request #269 from wolfgangmm/develop\n[bugfix] Check for free disk space in BrokerPool",
    "csid": "7f1b9179b89b449218755f61033085092d2947fb",
    "date": 1405249146000,
    "displayId": "7f1b917",
    "fileRevisionKey": [],
    "parents": [
        "c2c778863e18bad3cc761611135f5f63883b0313",
        "0da9e236196862f0d5cf847382583d2761c96f92"
    ],
    "repositoryName": "exist-git"
}

Notice the first endpoint accepts start and date parameters so you can filter by dates.

Hope that helps,

J July 14, 2014

Hi, thanks for your reply. I have a couple questions about your answer. For the 'changesetList' call, are the results guaranteed to be in order from newest to oldest? Also, is there a way to pre-filter those results by branch? The reason I ask is because I could see that call being expensive if I had to set maxResults to a high number like 1000 and keep making REST calls to 'changeset' until I reached the branches that I wanted and the dates were no longer in range. I also see some REST calls in the API spec that use a query parameter. Is there a custom query I could pass in which would do this in 1 REST call vs potentially 100's? Thanks!!

Piotr Swiecicki
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 14, 2014

Yes, changesetLit will guarantee to return elements in order.

But I'm afraid I can't find an endpoint to filter results by branches, so I am afraid you may want to iterate over the changesets until you find the branch you are interested in.

Feel free to raise a feature request in jira.atlassian.com/browse/FE if you think such service would be useful for other customers too.

Kind regards,

TAGS
AUG Leaders

Atlassian Community Events