Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,294,702
Community Members
 
Community Events
165
Community Groups

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

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

0 votes
Answer accepted

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

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Jira Service Management

Jira Service Management Documentation Opportunities

Hello everyone, Hope everyone is safe! A few months ago we posted an article sharing all the new articles and documentation that we, the AMER Jira Service Management team created. As mentioned ...

274 views 0 6
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you