Shruti_pathak1 | 2022-05-30 12:36:18 UTC | #1
Hi,
I am using /api/v2/users/search to get list of users that belong to X division and Y role. I ran the below query and go the results: {"sortOrder": "DESC", "sortBy": "email", "pageSize": 100, "pageNumber": 1, "query": [ { "fields": ["divisionId"], "value": "92fab5b0-8436-4585-9623-3c31f9452018", "type": "CONTAINS" } ] }
However i am unable to get any results using the below query: {"sortOrder": "DESC", "sortBy": "email", "pageSize": 100, "pageNumber": 1, "query": [ { "fields": ["roleId"], "value": "87xxxxxxxxx", "type": "CONTAINS" } ] }
Can you please help me get it right? I have tried with the field names roleID, userRole, role and nothing works. Once i get the response i am planning to group above two queries.
Eos_Rios | 2022-05-31 15:02:14 UTC | #2
Not sure you can get there through user search.
GET /api/v2/authorization/roles/{roleId}/users
Is the only way I've seen to get users within a specific role.
Jerome.Saint-Marc | 2022-05-31 15:32:45 UTC | #3
@Eos_Rios is correct. /api/v2/users/search does not support a search based on role id or role name.
GET /api/v2/authorization/roles/{roleId}/users would allow to get the list of users (id of the user to be more specific) who have this role assigned to them. But you will need to retrieve corresponding users to check their divisions.
Another way would need parsing. I mean you can do a user search using the divisionId, and requesting roles/permissions info to be returned as well ("expand": ["authorization"]). You would then have to parse the returned entities/users and check if the role you are looking for appears for each user (I mean parsing via code - not other API invoked).
Regards,
Shruti_pathak1 | 2022-06-07 05:26:31 UTC | #4
Thanks for your answers. Really appreciate.
John_Carnell | 2022-06-08 12:23:48 UTC | #5
This post was migrated from the old Developer Forum.
ref: 14934