atlassian-python-api
atlassian-python-api copied to clipboard
Grant repository permissions on bitbucket cloud
As far as i can see the Bitbucket.repo_grant_user_permissions method doesn't work with bitbucket cloud. If i use it, i get the following error:
bitbucket.repo_grant_user_permissions(WORKSPACE_NAME, REPO_NAME, USER_NAME, "PROJECT_WRITE")
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "XXX/venv/lib/python3.7/site-packages/atlassian/bitbucket/__init__.py", line 927, in repo_grant_user_permissions
return self.put(url, params=params)
File "XXX/venv/lib/python3.7/site-packages/atlassian/rest_client.py", line 341, in put
absolute=absolute,
File "XXX/venv/lib/python3.7/site-packages/atlassian/rest_client.py", line 236, in request
self.raise_for_status(response)
File "XXX/venv/lib/python3.7/site-packages/atlassian/rest_client.py", line 386, in raise_for_status
response.raise_for_status()
File "XXX/venv/lib/python3.7/site-packages/requests/models.py", line 953, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://api.bitbucket.org/2.0/projects/WORKSPACE_NAME/repos/REPO_NAME/permissions/users?permission=PROJECT_WRITE&name=USER_NAME
(Note: I replaced the variables)
Is this because bitbucket cloud doesn't seem to have projects but workspaces? And if so, how can I manage repo permissions on bitbucket cloud?
Bitbucket Cloud API documentation doesn't list that endpoint at all, AFAICT. See https://developer.atlassian.com/cloud/bitbucket/rest/api-group-repositories/
There is a way to list the permissions via the workspace, see https://developer.atlassian.com/cloud/bitbucket/rest/api-group-workspaces/#api-workspaces-workspace-permissions-repositories-repo-slug-get . But that doesn't document any PUT/POST methods, either.