Hi All,
I'm trying to remove security user role using API, but no luck yet.
I can create a mapping between user and security role using API:
/data/SecurityUserRoles
POST request looks like:
{
"UserId": "UserIDVal",
"SecurityRoleIdentifier": "11111111-1111-1111-1111-2EA6DC8E6711",
"AssignmentStatus": "Enabled",
"AssignmentMode": "Manual",
"SecurityRoleName": "Some name"
}
It works like charm. However, it does not give ID pf this assignment, so I could find it and modify or remove.
I need to remove this role now, but if I go and use filter to get this role like:
/data/SecurityUserRoles?$filter=UserId eq 'UserIDVal' and SecurityRoleIdentifier eq '11111111-1111-1111-1111-2EA6DC8E6711'
it finds just one assignment - the one like I have created. But if I do PATCH (or DELETE) instead of GET with this filter - I see error message like:
"More than one resource was found when selecting for update."
I can understand this message, because for GET request using filter like above Odata.context is '/data/$metadata#SecurityUserRoles' and even though there is a single result - it is returned like array. That is why API is saying that there are multiple results.
Is there any way to disable or delete user to security role mapping using REST API?
Thanks in advance