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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.