Hi Team ,
We are trying to implement to grant project permission to the user using powershell , and we are stuck in how to pass this values "[ \"READ\", \"CREATE\",\"ADMINISTRATION\"]" to a rest api
this below is the powershell syntax
$jParams = @{
Uri = (<bambooURL>, rest/api/latest/permissions/project/ -join "/") + "<ProjectName>" + "/users/" + "userID"
Method = 'PUT'
Headers = $jHeaders
}
How to pass this values "[ \"READ\", \"CREATE\",\"ADMINISTRATION\"]" to below command
try {
$bambooProjectAdminAddDataResponse = Invoke-RestMethod @jParams -ErrorAction Stop
}
Please assist us if anyone has suggestion how to achieve this
Hello @krishnateja ,
Please try the following:
$userID = '<username>'
$password = '<password>'
$credPair = "$($userID):$($password)"
$ProjectName = "<ProjectKey>"
$BambooURL = "https://bamboo.mydomain.net"
$encodedCredentials = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($credPair))
$Body = @( "READ", "CREATE", "ADMINISTRATION" )
$JsonBody = $Body | ConvertTo-Json
$Params = @{
Method = "Put"
Headers = @{ 'Authorization' = "Basic $encodedCredentials" }
Uri = -join($BambooURL + "/rest/api/latest/permissions/project/" + $ProjectName + "/users/" + $userID)
Body = $JsonBody
ContentType = "application/json"
}
Invoke-RestMethod @Params
You can find more information about Bamboo REST API on this page:
Best regards,
Eduardo Alvarenga
Atlassian Support APAC
--please don't forget to Accept the answer if the reply is helpful--
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.