Quantcast
Channel: Web services
Viewing all articles
Browse latest Browse all 2361

Web Service with ASP.Net

$
0
0

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);

            }


Viewing all articles
Browse latest Browse all 2361

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>