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
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.