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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

How to get information about specific branch

Edited

Hello, I'm using Bitbucket api thru HttpRequest. I want to get information about specific branch.

/rest/api/1.0/projects/project_name/repos/repo_name/branches/  - work fine

rest/api/1.0/projects/project_name/repos/repo_name/branches/default - works fine

but how ask about specific branch?

rest/api/1.0/projects/project_name/repos/repo_name/branches/develop 

or

rest/api/1.0/projects/project_name/repos/repo_name/branches/master

or
rest/api/1.0/projects/project_name/repos/repo_name/branches/refs/heads/develop -don't work 

Is it possible? 

1 answer

1 accepted

0 votes
Answer accepted
Maciej Adamczak
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Apr 14, 2021

Hi @aksimoN you can check the documentation page for the Bitbucket REST API:

https://docs.atlassian.com/bitbucket-server/rest/7.12.0/bitbucket-rest.html#idp210

The rest endpoint you should check is referenced as:

/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/branches

 You can use either the "base" or "filterText" params depending on the use case you have.

Thanks,
Maciej Adamczak
Atlassian Developer

I still don't get it:
/REST/API/1.0/PROJECTS/{PROJECTKEY}/REPOS/{REPOSITORYSLUG}/BRANCHES?BASE&DETAILS&FILTERTEXT&ORDERBY&BOOSTMATCHES

trying:



GET /rest/api/1.0/projects/Project_name/repos/Repo_name/branches?develop

 I get:

{
"size": 2,
"limit": 25,
"isLastPage": true,
"values": [
{
"id": "refs/heads/develop",
"displayId": "develop",
"type": "BRANCH",
"latestCommit": "8454018d5221826cc4d034197b84b6e83802e4d5",
"latestChangeset": "8454018d5221826cc4d034197b84b6e83802e4d5",
"isDefault": true
},
{
"id": "refs/heads/master",
"displayId": "master",
"type": "BRANCH",
"latestCommit": "d481152fd1c55fb7a049a25044ff5c532bdf231e",
"latestChangeset": "d481152fd1c55fb7a049a25044ff5c532bdf231e",
"isDefault": false
}
],
"start": 0
}

 still return 2 branches

Maciej Adamczak
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Apr 15, 2021

you need to construct the URL to provide pairs of param names and values, e.g.:

/rest/api/1.0/projects/PRS/repos/prs-slowniki/branches?base=develop

or

/rest/api/1.0/projects/PRS/repos/prs-slowniki/branches?filterText=develop
/rest/api/1.0/projects/PRS/repos/prs-slowniki/branches?base=develop 

First one still gets me both branches but

/rest/api/1.0/projects/PRS/repos/prs-slowniki/branches?filterText=develop

Second one working fine. I think I get it now 

how can i get branch list from branch type is a release?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events