/admin/realms/admin/users does not return [UserRepresentation]

When doing a GET to /admin/realms/admin/users, I get a slim version of UserRepresentation:

[{
   "id":"2b8f5030-d197-47f9-9b3b-631b2408fd7a",
   "createdTimestamp":1623094859490,
   "username":"admin",
   "enabled":true,
   "totp":false,
   "emailVerified":false,
   "firstName":"Admin",
   "disableableCredentialTypes":[],
   "requiredActions":[],
   "notBefore":0,
   "access":{
      "manageGroupMembership":true,
      "view":true,
      "mapRoles":true,
      "impersonate":true,
      "manage":true
   }
}]

I need for instance groups to also be returned.

Any idea why this is happening?

Anyone with any ideas?

This is the representation returned by the GET /{realm}/users endpoint of the current Admin API. In order to get the user’s groups, you have to call the GET /{realm}/users/{id}/groups endpoint: Keycloak Admin REST API

1 Like

Hi all,

What is the corresponding class for the endpoints HTTPGET "admin/realms/{{realm}}/users/{{userId}} and HTTPGET “admin/realms/{{realm}}/ui-ext/brute-force-user?briefRepresentation=false&first=0&max=11&search=*”, HTTPPUT "admin/realms/{{realm}}/users/{{userId}} ?
Is this one https://github.com/keycloak/keycloak/blob/main/core/src/main/java/org/keycloak/representations/idm/UserRepresentation.java?

Thank you in advance!

Yes. Those idm classes are the ones used by the API methods.

1 Like