cancel
Showing results for 
Search instead for 
Did you mean: 

9.0R4 Rest API - Rename Role Mapping Rules

bkoch
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)
4 REPLIES 4
gb2939
New Contributor

Re: 9.0R4 Rest API - Rename Role Mapping Rules

Hi, bkoch.

 

Did you have any luck with your issue?  I'm attempting to update the url-pattern of an access-url and getting a very similar error.

 

I'm doing a PUT on /api/v1/configuration/authentication/signin/urls/access-urls/access-url/xxxxxxxxx/url-pattern and getting...

 

 

HTTP/1.1 422 UNPROCESSABLE ENTITY
Content-Type: application/json
Content-Length: 321

{
  "result": {
    "errors": [
      {
        "message": "[/configuration/authentication/signin/urls/access-urls/access-url] Missing PolySelection ELEMENT"
      }, 
      {
        "message": "[/configuration/authentication/signin/urls/access-urls/access-url] Merge-Create: Create instance failed."
      }
    ]
  }
}

 

tc0nn
New Contributor

Re: 9.0R4 Rest API - Rename Role Mapping Rules

Same issue. 

 

Does anyone know what "Missing PolySelection ELEMENT" means?

tc0nn
New Contributor

Re: 9.0R4 Rest API - Rename Role Mapping Rules

It means their regexp is failing to parse (presumably) what you entered as the 
URL pattern

 

Place the correct URL in through the GUI and then pull it from the API to see what it looks like. Make sure your page name already exists also...

 

The URL for POST/PUT should simply be:

/api/v1/configuration/authentication/signin/urls/access-urls/access-url

Json body looks like:

{
    "realm-select": "pick-list",
    "url-pattern": "*/",
    "page": "page name",
    "user": {
        "enable-new-ux-pages": "false",
        "meeting-url": "*/meeting/",
        "post-authentication-signin-notification-id": "None",
        "post-authentication-signin-notification-skip": "false",
        "pre-authentication-signin-notification-id": "None",
        "realms": [ "ABC", "DEF" ]
    }
}

 

zanyterp
Moderator

Re: 9.0R4 Rest API - Rename Role Mapping Rules

@bkoch, this is not something that is possible at this time; it does require a delete and then add (or vice versa)
i would recommend letting your account team know it is something you would like to do.