Reputation: 113
I am trying to get commits on a particular branch in bitbucket stash.
I tried
https://<stash-url>/stash/rest/api/1.0/projects/<project-ID>/repos/<repo-slig>/compare/commits?from=<my-target-feature-branch>&to=master
which gives me
{
"values": [],
"size": 0,
"isLastPage": true,
"start": 0,
"limit": 25,
"nextPageStart": null
}
and the other url i tried is
https://<stash-url>/stash/rest/api/latest/projects/<project-ID>/repos/<repo-slug>/commits?until=<my-target-feature-branch>&limit=100
which gives me the whole commit history from master too.
can someone please help me? I am a newbie and I'm sure there is something wrong in my understanding of API docs
Upvotes: 1
Views: 16004
Reputation: 21
You can! Using the tag:
?until=refs/heads/{branch-name}
My example:
curl -u <user>:<pass> -X GET "https://stash.xxx.com/rest/api/latest/projects/{project-key}/repos/{repo-slug}/commits?until=refs/heads/feature/ALMENGI-460"
Upvotes: 1
Reputation: 8270
This gives you the list of commits only for provided branch:
GET https://api.bitbucket.org/2.0/repositories/{WORKSPACE}/{REPO}/commits?include={BRANCH}&exclude=master
See BitBucket documentation for more details.
Upvotes: 1
Reputation: 1340
Try:
https://<stash-url>/stash/rest/api/latest/projects/<project-ID>/repos/<repo-slug>/commits?until=<my-target-feature-branch>&limit=0&start=0
Upvotes: 1