We’re using a github user field for users to specify their GitHub username. I’d like to use Discourse’s API to make changes to a user, given their GitHub username. Is there an easy way to search for a user by a user field value?

Technically speaking, I can make a list of user field values:

GET /admin/users.json

Loop through each user to GET /users/:username.json

Collect user.user_fields[GITHUB_USER_FIELD_ID] from each one

but that’s prohibitively inefficient. Any chance there’s a method like

GET /users?user_fields[1]=foo&api_key=...&api_username=...

to get all users with user_fields[1] containing “foo” that exists or is in the works?

I’m a Ruby n00b, so haven’t been able to find my answer in the source. I also haven’t been able to find a feature in Discourse that lets you search by user field value from which to reverse engineer the proper call.

I looked around to see if a Ruby n00b like myself might be able to muster a pull request for this feature. It looks like the ability to search users by user_field value would first require adding support for user field searching into UserSearch – i.e., adding params like @user_field_id and @user_field_value. Am I on the right track?