UserRoles API to get the user roles

Hi,
I am looking for the UserRoles API that will allow me to get the current user roles from the orchestrator.
I hit the parent API /odata/ and see that we have the following entry returned.
{
“name”: “UserRoles”,
“kind”: “EntitySet”,
“url”: “UserRoles”
}

So I tried to hit the get request for the /odata/UserRoles but seems this is not exposed. I see that the /odata/Roles is exposed though.

Is there a way for me to get the user roles assigned for the user?

Hi @Vishal_Kalra,
I can’t find the “UserRoles” direct API, yet you can do this 2 following API’s in order to get each user’s Role:

1st API:

/odata/Roles

From there you get a list of Roles + their respective ID:
image

By using that ID, you can use the following Get Request, to get a list of users, with that role:

/odata/Roles/UiPath.Server.Configuration.OData.GetUserIdsForRole(key=62)

→ Where Key is your variable from the previous list.

image

And with this, you should have a list of users which in my example, are Admins.

hope it helps!

Best Regards,
Ignasi

1 Like

Thanks @ignasi.peiris

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.