It seems that since username is not in $userfields, it is not set and returned in function user_get_user_details() in /user/lib.php. And when it is not set, the user is considered to be invalid in function get_users() in /user/externallib.php. The fields returned must contain the criteria field for this user to be considered valid.
In reply to Richard Chui
Re: Calling "core_user_get_users" function using REST API
by Andre Figueiredo -
Hi Richard!
I have the same problem...when I use key=id, the core_user_get_users(and _by_field too) returns all users or a specific user, but when I use key=something else, doesn't work.
And when I list all user, the email address and username does not appear in response...
How do you resolve this?
Thanks!