by Ahmed Ragae.
I can use core_course_get_courses with Token and moodlewsrestformat=json
and It works good and get list of courses.
But when I use core_user_get_users_by_field I get nothing.
string moodleUrl = "http://moodle.local/webservice/xmlrpc/server.php";
string token = "123456789";
string result = "";
string apiName = "core_user_get_users_by_field&field=email&values[0]=mail@server.com";
string apiCall = moodleUrl + "?wstoken=" + token + "&wsfunction=" + apiName + "&moodlewsrestformat=json";
try
{
using (var client = new WebClient())
{
client.BaseAddress = apiCall;
client.Headers[HttpRequestHeader.Accept] = "application/json";
result = client.DownloadString(apiCall);
Response.Write(result);
}
}
catch(Exception es)
{
Response.Write(es.Message);
}