You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Hi I'm trying to create a script which will add existing user group to repository on bitbucket.
I tried something like this:
groups_for_adding = f'https://api.bitbucket.org/1.0/group-privileges/{workspace}/{repo}/{groupname} --data write'
response = requests.put(groups_for_adding, auth=HTTPBasicAuth(username, password))
print(response)
Also tried solutions from this link:
https://support.atlassian.com/bitbucket-cloud/docs/invitations-endpoint/
Any help is very welcomed... :)
Welcome to the community.
I've checked our API v1 documentation and compared it with the endpoint you've used and I believe you're just missing the "group_owner" which is the same as the workspace ID.
You can check the documentation on this link (Under "PUT group privileges on a repository").
Here's the exact endpoint:
PUT https://api.bitbucket.org/1.0/group-privileges/{workspace_id}/{repo_slug}/{group_owner}/{group_slug} --data "{privilege}"
As an example, if your repository is: some_workspace/some_repo
And your user group name is: some_group
The API endpoint would be:
https://api.bitbucket.org/1.0/group-privileges/some_workspace/some_repo/some_workspace/some_group
Btw, please also make sure you're using an App password (as your password credential) as we recently deprecated the Atlassian account password.
Hope it helps and do let me know if you have further questions that I can help with.
Regards,
Mark C
thanks for the answer, with this api I'm getting following answer
curl --request PUT --user user:password PUT https://api.bitbucket.org/1.0/group-privileges/{workspace_id}/{repo_slug}/{group_owner}/{group_slug} --data "{privilege}"
is not a valid privilege
tried with this commands:
curl --request PUT --user user:password https://api.bitbucket.org/1.0/group-privileges/some_workspace/some_repo/some_workspace/some_group --data read
curl --request PUT --user user:password https://api.bitbucket.org/1.0/group-privileges/some_workspace/some_repo/some_workspace/some_group --data "read"
any idea what is wrong?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I've tried the similar CURL Command below, however, it works fine on my end using an App password.
curl --request PUT --user user:password https://api.bitbucket.org/1.0/group-privileges/some_workspace/some_repo/some_workspace/some_group --data read
Would you be able to confirm if you're using an App password?
You can also try to add the flag -vv in your CURL command to debug it further and see what's happening when it tries to connect to Bitbucket.org.
Let me know how it goes.
Regards,
Mark C
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.