How to get users in few specific groups?

I need to get the list of users in a specific group or I can filter the group in my code. I need the list of users in my application.

I tried the following nothing worked.
https://xxx.oktapreview.com/api/v1/users/
https://xxx.oktapreview.com/api/v1/users//groups
https://xxx.oktapreview.com/api/v1/groups?filter=type eq admin_name
https://xxx.oktapreview.com/api/v1/groups?q=admin_name
https://xxx.oktapreview.com/oauth2/default/v1/groups
https://xxx.oktapreview.com/oauth2/default/api/v1/groups

Can someone help me. I am getting 4xx error for all the above when i try in java.

I have posted 2 different post for with the details.

try this https://${yourOktaDomain}/api/v1/groups/${groupid}/users

https://developer.okta.com/docs/reference/api/groups/#group-member-operations

If you looking for users in a Application then check out this

https://developer.okta.com/docs/reference/api/apps/#list-users-assigned-to-application

1 Like

Hi! Hmm. A 405 “Method not allowed” would usually indicate you are doing something other than GET to try to retrieve this from the API. For example, POST, PUT, etc. wouldn’t be accepted.

Now, once you are beyond that you can pull just the specific group by name using the “q” parameter, the fourth one in your list from above. That looks for the group name using a “starts with” operation.

Now, for the final part of your question, to get the users from a particular group look in the “_links” section of the JSON response and grab the “users” value as the link to use. If you peek at it you will see it has the GUID for the group in the URL, so if you knew that before you could skip my middle step :slight_smile:

Thank you both for your responses.
API call didn’t work for me unfortunately got 405/400 error. Using okta sdk solved the issue. There is a built in listGroups method helped.

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