Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,456,655
Community Members
 
Community Events
176
Community Groups

Workspaces and repositories not showing in https://api.bitbucket.org/2.0/workspaces

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.

1 answer

1 accepted

0 votes
Answer accepted
Caroline R Atlassian Team Mar 10, 2022

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. :)

Like Caroline R likes this

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events