BitBucket API so far has been an interesting experience, let's say.
We have sometimes very brief generated docs across various URLs with bits of functionality peppered between bitbucket.org/rest/api/1.0
, api.bitbucket.org/2.0
etc and a way to get a list of repositories:
GET https://api.bitbucket.org/2.0/repositories?role=x
This response contains a UUID for the repo which the docs say:
This can be used as a substitute for the slug segment in URLs. Doing this guarantees your URLs will survive renaming of the repository by its owner, or even transfer of the repository to a different user.
Sounds like common sense to me! So how about getting a list of branches?
GET https://api.bitbucket.org/2.0/repositories/{username}/{repo_slug}/refs/branches
UUID
can be used in place of repo_slug
which is good. But it also bizarrely wants username
(which can confusingly also be the org name). So the point about being resilient to moving the repository is pointless. And does the list of repositories return this? Nope.
So how, using the repository UUID, do I find out the username
, or better yet get a list of branches with just the UUID which would be sensible thing to support like on GitLab/GitHub? Thanks.