Hi, I want to create a new read only group that id like to add to all of our existing repos without having to add them one at a time.
Is this possible?
There isn't anything out of the box that I'm aware of but you could do this with either ScriptRunner to the Bitbucket REST API.
Use this REST API to add a group to a project:
PUT: /rest/api/1.0/projects/{projectKey}/permissions/groups?permission={permission}&name={group}
Replace {projectKey} with the project's key.
Replace {permission} with PROJECT_READ, PROJECT_WRITE or PROJECT_ADMIN
Replace {group} with the name of an existing group.
Use this REST API to add a group to a repository in a project:
PUT: /rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/permissions/groups?permission={permission}&name={group}
Replace {projectKey} with the project's key.
Replace {repositorySlug} with the repositories slug (typically the name of the repo with spaces replaced by hyphens). The two rest APIs I mention below can be used to get the slugs.
Replace {permission} with REPO_READ, REPO_WRITE or REPO_ADMIN
Replace {group} with the name of an existing group.
To get the first 1000 projects on the server use:
GET: /rest/api/1.0/projects?limit=1000
And to get the first 1000 repos in the project use this:
GET: /rest/api/1.0/projects/{projectKey}/repos?limit=1000
Replace {projectKey} with the project's key which was obtained with the GET REST call above.
@Steven Whitman , It is help us if you share the new API's to add the groups to Bitbucket repositories? those API's not working what you mentioned in the solution
We are using Bitbucket cloud.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry I don't have access to Bitbucket cloud, you'd need to ask someone else what are the equivalent APIs for the cloud product.
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.
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.