Querying the last commit on a particular branch in Bitbucket using the Rest API Edited

Hey guys,

 

Im trying to get the latest commit for a particular branch in stash (deploy).  When I run the rest api call - 

curl -X GET -H "<authentication info>" "http://<ourstashurl>/stash/rest/api/latest/projects/<projectname>/repos/<reponame>/compare/commits?from=deploy&start=0&limit=0"

However, the results that I get from running this are not correct.  I am getting the lastest commit from other branches, but not the "deploy" branch.

 

How should I adjust this rest API call in order to get the latest commit from the "deploy" branch?  The piece of information that I want is the date of the latest commit for the "deploy" branch.

 

Thanks.

1 answer

1 accepted

I found the answer - 

 

curl -X GET -H "<some authorization>" -H "Content-Type: application/json" "http://<stashurl>/stash/rest/api/latest/projects/<projectname>/repos/<myrepo>/commits?until=deploy&limit=0&start=0"

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

1,767 views 1 5
Read article

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