Hi All,
I was trying to assign permission to a group using REST but it failing with error message "Bad Request". Below is my REST code to assign Contribute permission to group with ID 95, It would great help if someone can help me to fix this.
// Set permission on a specific group
$.ajax({
url: "<Site URL>/_api/web/roleassignments/addroleassignment(principalid=95, roledefid=1073741827)",
type: "POST",
contentType: "application/json;odata=verbose",
headers: { "Accept": "application/json; odata=verbose","X-RequestDigest": $("#__REQUESTDIGEST").val(),"X-HTTP-Method": "POST" },
success: function (data) {
// Returning the results
alert('Contribute permission set on group');
alert("Error: " + JSON.stringify(data));
},
error: function (data) {
alert("Error: " + JSON.stringify(data));
}
});
~Harish