Hi Team,
We have a requirement to get repo code using the Bitbucket API.
I am able to list all the api for a user, using basic auth, but while using the
"https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D"
, it gives a 404 error where I am passing the uuid of repo as the repo slug.
Thanks,
Sakshi
Hi!
Let's get all repositoty,
without repo_slug parameter?
Cheers,
Gonchik Tsymzhitov
Hi Gonchik,
I am able to get all the repository after passing the parameter of role and that's how I have received the uuid corresponding to a repository.
Although, when I am passing the same in the api as mentioned above, it is giving a 404 error.
Sakshi Barnwal
From the API docs:
This can either be the repository slug or the UUID of the repository, surrounded by curly-braces, for example: {repository UUID}.
Are you using the curly-braces around the UUID?
Here's an example with a public repository:
https://api.bitbucket.org/2.0/repositories/mirror/%7Be14d6747-e69d-4ee3-a64a-a2ec8d3d5034%7D
Tyler,
I have tried with the curl braces, but it gave a 404 exception. The repository is a private repository for which I have member access.
For getting the list of repositories, I have used
curl -X GET --user <username>:<password>https://api.bitbucket.org/2.0/repositories?role=member
and using the uuid for a repo,
curl -X GET --user <username>:<password> https://api.bitbucket.org/2.0/repositories/<username>/{<uuid_repo>}.
Do, let me know if I am missing a step.
Do you have 2-factor-auth / 2-step-verification disabled? If you use 2fa, you should authenticate using OAuth2 instead of basic auth.
More here: https://developer.atlassian.com/bitbucket/api/2/reference/meta/authentication
We are using basic authentication for bitbucket in the org, hence that shouldn't be the cause for 404 error.
Also, I am able to get the repo list using
```curl -X GET --user <username>:<password>https://api.bitbucket.org/2.0/repositories?role=member ```.
Not sure how to proceed further for this.
@Gonchik Tsymzhitov
What is the error response in the 404? It should have a JSON payload with more information about the issue.
It looks like you're new here. Sign in or register to get started.