I have an issue where the details of the workspace are not populating using https://api.bitbucket.org/2.0/workspaces. I have two workspaces (let's call them Main and Secondary) where I created 2 OAuth credentials.
I created an OAuth in the Main workspace and then authenticated it to https://api.bitbucket.org/2.0/workspaces via the postman. After clicking "Send", it is populating all of the repositories and workspaces. When I do the same thing on my Secondary workspace, I am not getting anything.
Both have permissions to read the Account, Workspace membership, projects, repositories, and pull requests. I am the only user on my bitbucket instance and I am the only user who created both workspaces. I have provided steps to reproduce below for your reference:
Steps to reproduce:
1. Open Postman.
2. At the URL, type in https://api.bitbucket.org/2.0/workspaces
3. Change the call type to GET.
4. At the Authorization tab, select OAuth 2.0 as the Type.
5. Under the Configuration Options, configure the "Access Token URL" to https://bitbucket.org/site/oauth2/access_token
6. Provide the Client ID and secret. (There will be two tests, one for the Main and one for Secondary)
7. At the bottom of the Configure Token section, click "Get New Access Token".
8. It should successfully authenticate and will show you the token details.
9. Click the "Use Token" at the upper right of the Token Details pop-up page. This will automatically use the access token.
10. At the upper right of the page, click Send.
Expected result: Using the Client ID and Secret for both Main and Secondary populates the workspaces and repositories.
Actual result: Using the Main Client ID and Secret only populates the workspaces and repositories.
Hi, Abel, welcome to the community!
My assumption is that the API is not returning any results when you try to run it using an OAuth linked to a shared workspace, is that correct? In case you are not familiar with shared and personal workspaces, you can read more about their differences here.
In summary, the personal workspace is the one that was created when you registered your Bitbucket account, so it is directly linked to your account/email. A shared workspace is the one that you created after you already had a Bitbucket account.
If that is the case, as the endpoint you are using should return a list of workspaces accessible by the authenticated user, this is actually expected that you don’t receive any results when using an OAuth generated by a shared workspace, as this type of workspace is not linked to a specific user.
With that said, if you are looking for all the repositories under this workspace, I suggest that you use the following endpoint:
/2.0/repositories/{workspace}
This will return a paginated list of all repositories owned by the specified account or UUID. You can find more details about this endpoint here:
Please don't hesitate to ask for any further information if needed.
Kind regards,
Caroline
I was not aware that there are shared workspace and personal workspace. Thank you so much for the explanation. That clears everything. :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.