Problem to load all users by role name in Rest API

Hi,
In UI designer I have a select widget populate by “users” variable.
“users” is a External API.
I want to load all users by role name “director”.

With:
…/API/identity/role?p=0&c=100&f=name=director
I load the role with id 2.

With:
…/API/identity/user?p=0&c=200&f=enabled%3dtrue&o=lastname ASC&f=enabled=true&f=role_id=2
I load all users by role id 2.
“users” = …/API/identity/user?p=0&c=200&f=enabled%3dtrue&o=lastname ASC&f=enabled=true&f=role_id=2

Unfortunately in many development environments, not always the id is 2!
Is there an API that load all users by role name?

Thanks
Manolo

Hello,

If you go to the portal here /bonita/portal/homepage#?_p=rolelistingadmin you can see that it performs a search like you.

First it retrieves the role_id : http://127.0.0.1:8080/bonita/API/identity/role?p=0&c=10&o=displayName%20ASC

Then it retrieves the users with the corresponding role_id : http://127.0.0.1:8080/bonita/API/identity/user?p=0&c=10&o=lastname%20ASC&f=enabled%3Dtrue&f=role_id%3D1

If you want, you can create your custom REST API, see : http://documentation.bonitasoft.com/rest-api-extensions

Kind regards,

Jérémy

Thank you very much Jérémy. Already solved my problem.

Best regards