Hi guys,
While automating user creation in the Atlassian Cloud, I stumbled upon a problem.
Creating an Atlassian account for a user works good. The user is able to access Jira and Confluence.
However, I do not know how to invite a user to Bitbucket via API. What I want to do is add the user to a workspace and some groups within it. I presumed that if I added a user to a group, then they would gain access to the workspace as well.
That is why I tried to use groups endpoint (https://support.atlassian.com/bitbucket-cloud/docs/groups-endpoint/).
However, it requires a UUID. And I do not know how I can get that, if the user is not invited to the Bitbucket cloud yet.
Is there any way to do that via API? Thanks in advance for all the suggestions
Hi, @Michał Łątkowski! Welcome to the community!
In order to find the UUI of a member of your workspace, you can run the following API call:
$ curl -X GET -u <username>:<AppPassword> "https://api.bitbucket.org/2.0/workspaces/<workspace>/members?fields=values.user.display_name,values.user.uuid"
You can also replace the UUID for the email-id:
curl --request PUT --user username:AppPassword --header "Content-Type: application/json" https://api.bitbucket.org/1.0/groups/{workspace-id}/{group-slug}/members/{email-id} --data '{}'
You just need to replace the workspace ID, the corresponding group slug, and the email id of the user you would like to add to this group.
However, if these users do not have a Bitbucket account yet, you will receive an error message saying "No user with validated email address".
So, if you want to add users who do not have a Bitbucket account yet, we recommend that you use the following API call:
curl -X PUT -u username:password https://api.bitbucket.org/1.0/users/{workspace_ID}/invitations \
--header "Content-Type: application/json" \
--data '{"email":"EMAIL ID","group_slug":"my-group"}'
I hope this helps, but do let me know if you have any questions.
Kind regards,
Caroline
Caroline, thank you so much for your detailed explanation :)
Have a nice day!
Kind regards,
Michał
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, Michał!
I'm glad to help! Please don't hesitate to create new questions in our community if needed.
Have a nice day too!
Kind regards,
Caroline
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.