Filter Option, Docs? Need Help!

Dear,

It is always faster if the filtering is done on the Database instead of PHP. I see there is a filter option on listUsers.

But how to use it since there a no docs…

Yes, but the PHP filtering is only to unset very sensitive data. If you don’t have hundreds or thousands of users, this shouldn’t hurt much.

Have a look at

and

You can use a short filter syntax, if you send an api request to
/api/cockpit/listUsers?token=xxtokenxx with {"filter":"raffael"}.
It performs a regex search for all users with name user or email, that contains “raffael”.

If you send {"filter":{"user":"admin"}}, it lists the one user “admin”.

Except that, the filtering is the same like everywhere in Cockpit. Just send your filter as get parameter or as json encoded post like this
{"options":{"filter":{"active":true},"fields":{"user":true,"email":true}}}
and get a result set with all users, that are active.

1 Like

Thanks! Cockpit is nearly amazing. I looked at Directus but had some UI issues and some API issues. Cockpit is nearly great. There just a couple things I would like to see chanced.

But support is great and cockpit self it also great

3 Likes