cancel
Showing results for 
Search instead for 
Did you mean: 

9.0R4 Rest API - Rename Role Mapping Rules

Highlighted
New Contributor

9.0R4 Rest API - Rename Role Mapping Rules

Hello, 

 

Is it possible to rename a Role Mapping rule using the Rest API?  

 

When I attempt to rename a rule using a PUT call it returns a message saying the change was successful but it ends up creating a new rule with the new name and the old rules still exists. I could then delete the old rule with a DELETE call but I would rath just perform the rename in one call if possible. This way the rule numbers are maintained. 

 

Here's what I've tried:

 

PUT to 
/api/v1/configuration/users/user-realms/realm/test_realm/role-mapping-rules/rule/OLD_RULE_NAME

 

JSON object:

Array
(
[name] => New Rule Name
[roles] => Array
(
[0] => testrole
)

[stop-rules-processing] => true
[user-name] => Array
(
[test] => is
[user-names] => Array
(
[0] => testuser
)

)

)

 

Result:

Array
(
[result] => Array
(
[info] => Array
(
[0] => Array
(
[message] => Operation succeeded without warning or error!
)

)

)

)

 

I have also tried a PUT call to:  

/api/v1/configuration/users/user-realms/realm/test_realm/role-mapping-rules/rule/OLD_RULE_NAME/name

 

using this JSON object:

Array
(
[name] => New Rule Name

)

 

It results in this error:

 

Array
(
[result] => Array
(
[errors] => Array
(
[0] => Array
(
[message] => [/configuration/users/user-realms/realm[name = "test_realm"]/role-mapping-rules/rule] Missing PolySelection ELEMENT
)

[1] => Array
(
[message] => [/configuration/users/user-realms/realm[name = "test_realm"]/role-mapping-rules/rule] Merge-Create: Create instance failed.
)

)

)

)

 

If there is a way to rename a rule in one shot please let me know.

 

Thanks!

Tags (2)