REST API: check if user exists?

Re: REST API: check if user exists?

by e sencan -
Number of replies: 0

Hi

Moodle requires unique emails so if you have the user's email you can do a check to see if that user exists in Moodle. 

Call 'core_user_get_users' with 'criteria[0][key]=email' and 'criteria[0][value]={useremail}' where {useremail} is the user's email. Moodle will spit back a list of users matching that email. Since email has to be unique there should would one element if the user exists - the element will provide you with the userid. If no elements come back the user is not in the system and you can add them in.