I am trying to add existing user/group to a bitbucket repository (public/private) using REST API 2.0. I am not able to find any endpoints available for it! Can anyone help me with it?
This might be a duplicate of the question: https://community.atlassian.com/t5/Bitbucket-questions/Add-user-to-private-repository-via-BitBucket-REST-API-2-0/qaq-p/1169437
But even there no answers are found!!
Hi @Akshay b and welcome to the community.
At the moment there is no support for adding users/groups to a repo via API 2.0 in Bitbucket Cloud. Until this is implemented, we have temporary support for 1.0 API resources that can do this.
The following endpoint can be used to send an invitation for direct repo access, see POST send an invite:
The following can be used to send an invitation to a user group, see Issue an invitation to a group:
If you want to create a new user group in a workspace, you can use the following endpoint, see POST a new group:
I hope this helps, please feel free to let me know if you have any questions!
Kind regards,
Theodora
Thanks @Theodora Boudale . I was able to add groups to a repository in a different way. Check out my answer.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Theodora Boudale ,
is your answer still valid? Are these Endpoints still available?
Thank you in advance!
Regards,
William
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I was able to add groups to a repo via API 2.0 in Bitbucket Cloud. Instead of trying to add groups to a repo directly, I tired to add Branch Permission to a repository. Something like this.
curl --url "https://api.bitbucket.org/2.0/repositories/{WORKSPACE}/branch-restrictions" --user username:password --request POST --header "Content-Type: application/json" --data "{"kind": "push", "pattern": "{branch_name}","groups": [{"name": "{group_name}","type": "group", "slug": "{group_name}"}]}"
By executing this I was able to add the group to my repository and also was able to set branch permission to that group. But there is one issue, Executing this added all the available groups to the repository with admin access.
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.