James
James

Reputation: 809

How to give a group write access to a Bitbucket repository via shell command line

I've created a Bitbucket repository using a Jenkinsfile, with the following code (with private data replaced with {}):

sh "curl -X POST -H \"Authorization: Basic {KEY}=\"
\"https://api.bitbucket.org/2.0/repositories/{project}/{repository_name}\" 
-H \"Content-Type: application/json\"  
-d '{\"has_wiki\": true, \"is_private\": true, \"project\": {\"key\": \"{key}\"}}'"

This creates a repository with default access rights.

I need to then give a Group Write access to this repository.

I've scoured the internet and I can't find any up to date documentation or examples of how to do this. How do I do this using a shell command?

Upvotes: 2

Views: 1263

Answers (1)

CodeWizard
CodeWizard

Reputation: 142632

What you are looking for is: "permission":"write"

Here are the API calls to update the group permissions:

"permission":"write"

The full API call:

curl --request PUT --user username:password \ 
<repo url> \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data '{"name":"developers","permission":"write","auto_add":true}'

Upvotes: 3

Related Questions