Hi,
is there a way to get a list of all branches for a BB Server repo via a GET similar to the POST and DELETE methods described in https://docs.atlassian.com/bitbucket-server/rest/4.13.0/bitbucket-branch-rest.html?utm_source=%2Fstatic%2Frest%2Fbitbucket-server%2Flatest%2Fbitbucket-branch-rest.html&utm_medium=301#idm45495357768480
I tried sth. like
def response = stash.get(path: "api/1.0/projects/$projectKey/repos/$slug/branches/", contentType: 'application/json', headers: ["Authorization": authenticatonHeader])
and it didn't work... GET always empty Response.
Any help is greatly appreciated!
Hi
Below rest endpoint should give the list of branches in a repository.
I could see that you are using that in a script. Have you tried with a REST client such as Postman or using cURL ?
Also, you may check the authentication and the user with which you are trying has the read access.
Best regards,Prasanth Thaikkalloor
@Prasanth,
User @puddleglum2 has attempted to respond to you via a duplicate thread with the following:
thanks for the quick answer... but unfortunately it doesn't solve the issue. The link you gave here does not contain a GET method in REST API for ...$slugs... (repos) alone... The only GET available is a GET of the Branch Default Settings like api/1.0/projects/$projectKey/repos/$slug/branches/Default which I use already. We really need this list of all remote branches. In my link above there is e.g. a DELETE method for branches implemented but no GET... can't understand why... (see DELETE("/rest/branch-utils/1.0/projects/{projectKey}/repos/{repositorySlug}/branches" ....)The access rights do work as we use much of the REST API here.... any further help is still highly appreciated!
Note that I'll be removing the duplicate post, but please feel free to reply directly on this case if you have any further information to provide!
Regards,
Shannon
The link which I gave definitely have a GET method. Please see below
/rest/branch-utils/....../branches doesn't have a GET. I tried the above and it worked for me.
Sorry, I had a repeated typo... for sure it now works! Thanks for your help and have a great time!
It looks like you're new here. Sign in or register to get started.