Bitbucket Server API to get information of all the branches in a repo

Harshit Singhvi December 9, 2018

Hi Team,

 

I am looking for a bitbucket server api which provides details for all the  branches in a repo.

 

For ex:.

The json output should contains details like

- Author of the branch

- Creation date of the branch

- Origin branch if any.

 

curl -s -u "XXXX":"XXXXX" "https://XXXXXX.com/rest/api/1.0/projects/DEMO/repos/democonfiguration/branches?limit=2000"

 

Getting this as output

 

  • "size":1000,
  • "limit":1000,
  • "isLastPage":false,
  • "values":[
    1. {
      • "id":"XXXX,
      • "displayId":"XXX",
      • "type":"BRANCH",
      • "latestCommit":"XXXXX",
      • "latestChangeset":"XXXX",
      • "isDefault":false

I am using the above api but i am not getting the desired output (author name , creation date)

 

Can anyone please help as how can i get the creation date and author name of all branches in a repository

 

We are using 5.13.0 bitbucket server enterprise edition

1 answer

1 accepted

0 votes
Answer accepted
Jobin Kuruvilla [Adaptavist]
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 10, 2018

Bitbucket doesn't track that sort of metadata yet. You will need a plugin to do it.

Git doesn't either but there are some clever ways to find it I guess. Check out https://stackoverflow.com/questions/12055198/find-out-git-branch-creator/19135644 and see if it helps.

Harshit Singhvi December 11, 2018

Hi jobin,

 

Thanks for the reply.

From the stackoverflow I tried the solutions mentioned but again we can get only the last committer of the branch since the creator metadata is not stored in git.

 

Incase you have any other way please let me know

Thanks 

Harshit

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events