The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How can I get the full list of repositories with REST API

nellinux
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 17, 2020

I can get the list of my repositories or the repositories of the groups I belong to, with:

curl https://api.bitbucket.org/2.0/repositories/username/

curl https://api.bitbucket.org/2.0/repositories/group1/

curl https://api.bitbucket.org/2.0/repositories/group2/

But, how can I get the full list of the repositories I have access permission?

Thank you.

  Nello

2 answers

2 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

1 vote
Answer accepted
Daniil Penkin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 18, 2020

Hello @nellinux,

Welcome to the Community!

Here's the endpoint that returns exactly what you're after:

https://api.bitbucket.org/2.0/user/permissions/repositories

Here's the relevant API documentation page.

Hope this helps. Let me know if you have any questions.

Cheers,
Daniil

0 votes
Answer accepted
ruben.labruyere
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 18, 2020

While I admit Atlassian would do great on having an API call that just simply generates a list no matter the size but nooo they had to make it difficult. :')

Your best bet is to use the API call "/repositories/{your_team}/pagelen=25". This will return a paginated result. Good thing about it, is that the response comes with a property "Next". Which holds the url of the API call to get the next page of results.

So the steps you need to take are:

1) POST /repositories/{your_team}/pagelen=25

2) Parse the JSON response. This looks like:

{

"page": 1,

"pagelen": 25,

"next": "/repositories/{your_team}/pagelen=25&startsAt=25"

"previous": "...",

"values":  []

}

3) Send the POST request with as url the value of the above "next" property

4) Repeat steps until the values.length < pagelen

nellinux
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 18, 2020

Thank you :-)

TAGS
AUG Leaders

Atlassian Community Events