Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to Implement WRITE Permission in Bamboo deployment plan using rest API

Bibin Mohan Kareethra August 23, 2021

Hi All,

I am facing issue while pushing WRITE permission in deployment plan using rest API. But while pushing READ permission getting success. 

Below script from view-source of Bamboo deployment plan 

permissions.push({ name: 'READ', label: 'View' });

permissions.push({ name: 'WRITE', label: 'Edit' });

 

Script Runner script :

def updating_Write_bodyJson = JsonOutput.toJson(["WRITE"] )
def updating_Write_http = new HTTPBuilder( "https://bamboo-abc.com/rest/api/latest/permissions/deployment/${projectId}/groups/${groupName}-${item}" )
updating_Write_http.request(PUT) {
headers."Authorization" = "Basic ${authString}"
body = updating_Write_bodyJson
requestContentType = ContentType.JSON

response.success = { resp ->
log.warn "Updating group premission ${item} of deployment project request Success! with status ${resp.status}"

}
response.failure = { resp ->
log.warn "Updating group premission ${item} of deployment project request failed with status ${resp.status}"
log.warn resp.statusLine
}

 

Error : 

 

2021-08-23 16:25:47,230 WARN [runner.ScriptBindingsManager]: Updating group premission administrators of deployment project request failed with status 400

2021-08-23 16:25:47,231 WARN [runner.ScriptBindingsManager]: HTTP/1.1 400

2021-08-23 16:25:48,407 WARN [runner.ScriptBindingsManager]: Updating group premission developers of deployment project request failed with status 400

2021-08-23 16:25:48,407 WARN [runner.ScriptBindingsManager]: HTTP/1.1 400

 

 

Thanks & Regards

Bibin Mohan. K

 

1 answer

1 accepted

Suggest an answer

Log in or Sign up to answer
0 votes
Answer accepted
Bibin Mohan Kareethra August 25, 2021

Hi All, 

It worked . 

def updating_Write_bodyJson = JsonOutput.toJson(["READ","WRITE"] )

def updating_Write_http = new HTTPBuilder( "https://bamboo-abc.com/rest/api/latest/permissions/deployment/${projectId}/groups/${groupName}-${item}" )
updating_Write_http.request(PUT) {
headers."Authorization" = "Basic ${authString}"
body = updating_Write_bodyJson
requestContentType = ContentType.JSON

response.success = { resp ->
log.warn "Updating group premission ${item} of deployment project request Success! with status ${resp.status}"

}
response.failure = { resp ->
log.warn "Updating group premission ${item} of deployment project request failed with status ${resp.status}"
log.warn resp.statusLine
}
}

 

Thanks & Regards

Bibin Mohan. K

TAGS
AUG Leaders

Atlassian Community Events