Hello,
I created a private repository and need to check the contents using the BitBucket API.
Is this possible? If it is, could somebody please outline the steps?
Thanks you very much in advance.
Hello @J P,
Thanks for reaching out.
Yes, it is definitely possible. Here's an endpoint to list repositories under an account (user or team). To include private repositories in the response you need to authenticate your request using one of the methods.
Here's an endpoint to list the root of the repository, and this one is to fetch the content of a file or list a directory at the given path and revision. Similarly, you need to authenticate your requests if you're browsing a private repository.
Hope this helps. Let me know if you have any questions.
Cheers,
Daniil
Hi Daniil,
Your reply is much appreciated. I went to the second link you posted about authentication methods and tried following the instructions for Oauth2.
When trying to follow the https link in section '1. Authorization Code Grant (4.1)'
( https://bitbucket.org/site/oauth2/authorize?client_id={client_id}&response_type=code )
and enter my client id, which I am getting from here ( https://bitbucket.org/!api/2.0/user?access_token={access_token )
I get a message saying "invalid client_id. - This integration is misconfigured. Contact the vendor for assistance."
Any idea why this might be happening?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hm, I think you got confused by the terms. Client ID for OAuth is the OAuth consumer key which you need to set up first in your Bitbucket settings (Bitbucket Settings → OAuth → OAuth consumers → Add consumer).
The easier way to try out the API is app passwords, so you might want to use them first, and then configure OAuth.
Hope this helps.
Cheers,
Daniil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey Daniil,
Using app password worked for me, thanks a lot!
If anybody in the future wants to know how to use app passwords:
https://confluence.atlassian.com/bitbucket/app-passwords-828781300.html
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.