Web services

How to get all users with core_user_get_users and PHP

 
Picture of Josip Zmikic
How to get all users with core_user_get_users and PHP
 

Hi there,

i have been going round and round witht his problem. I can get specific user if i use their id or email, but i cant get more then one user via api call.

The user i get isnt limited to just admin or loged in user so permisions should be ok.

The web service documentation states that i can use % in my search so my general idea was to send request for email with % criteria and that would return me list of all users that have email.

After that failed i tryed using auth field as a filter but that one never returned anything to me.

Can someone give me a working example for my issue. The curl url i use for this is :

$url.'webservice/rest/server.php'. '?wstoken=' . $token . '&wsfunction=core_user_get_users&moodlewsrestformat=json&criteria[0][key]=email&criteria[0][value]=%';

This is just one variation of what i tryed but usuallythe resulti get is either an empty json or just empty result with nothing in it.

Thank you in advance.

Kind regards,

Josip

 
Average of ratings: -