One of my customers is running an instance of Atlassian Bitbucket Server v5.14.0 (not Bitbucket Cloud!) in their intranet. I try to tap into the REST API to get a list of projects and for the one I'm working on, get a list of git repositories:
# first REST API call: returns list of projects on server,
# `?limit=1000` appended to work around / disable pagination:
# https://docs.atlassian.com/bitbucket-server/ ...
# ... rest/5.14.0/bitbucket-rest.html#idm46783597898304
curl --header "Authorization: Bearer <my access token>" \
https://<bitbucket hostname>/rest/api/1.0/projects?limit=1000
# second REST API call: returns list of repos in <project ID>
# https://docs.atlassian.com/bitbucket-server/ ...
# ... rest/5.14.0/bitbucket-rest.html#idm45701776945568
curl --header "Authorization: Bearer <my access token>" \
https://<bitbucket hostname>/rest/api/1.0/projects/<project key>/repos?limit=1000
In general, this works well. Problem however is that the second call only returns repositories with public visibility and although I am able to see both public and private repos in the web application after logging in, there does not seem to be any way to get the private ones using the REST API.
I also tried
# alternate approach: list repo by name
# https://docs.atlassian.com/bitbucket-server/ ...
# ... rest/5.14.0/bitbucket-rest.html#idm46783597782384
curl --header "Authorization: Bearer <my access token>" \
https://<bitbucket hostname>/rest/api/1.0/repos?name=<name of private repo>
but that does not return the repository info either.
I have thoroughly searched the documentation, but so far, this just seems to be a bug in Bitbucket and getting private repositories over the REST API is simply not possible.
Q: Does anyone how to get this to work ?
Q: Is anyone using the Bitbucket Server REST API ? What's your experience / impression ?