79433618

Date: 2025-02-12 15:35:11
Score: 0.5
Natty:
Report link

I know the question was about Cloud Bitbucket API, but leaving also the answer here for those who did such a search for a Server installation and found this, like me.

There's default-branch endpoint of the repo which serves the default branch name without fetching all the branches

rest/api/1.0/projects/{project_key}/repos/{repo_slug}/default-branch

Response example:

{
    'id': 'refs/heads/master',
    'displayId': 'master',
    'type': 'BRANCH'
}

Tested on v8.19.

Doc: https://developer.atlassian.com/server/bitbucket/rest/v905/api-group-project/#api-api-latest-projects-projectkey-repos-repositoryslug-default-branch-get

Reasons:
  • Probably link only (1):
  • Has code block (-0.5):
Posted by: and1er