Thanks Sascha works like a charm,

 

In case it helps someone else this is a simple version of working code (using this as temporary code to set up an initial user, normally would suggest a cleaner way to get the userId from keycloak but search works fine for now):

 

UserRepresentation user = new UserRepresentation();

user.setUsername("testuser");

user.setFirstName("Test");

user.setLastName("User");

kc.realm("master").users().create(user);

kc.realm("master").users().search(“testUser”, 0, 1).forEach(

   UserResource userResource = kc.realm("master").users().get(user.getId());

  CredentialRepresentation credential = new CredentialRepresentation();

   credential.setType(CredentialRepresentation.PASSWORD);

   credential.setValue("test123");

   credential.setTemporary(true);

   userResource.resetPassword(credential);

)

 

Will