从 .Net 控制台应用程序访问 Moodle API

3

我需要管理我们的 Moodle 中的一些属性,包括(但不限于)创建/更新用户和管理注册。

我需要在 .Net(4.0+)控制台应用程序中创建此界面,以便可以从其他系统处理信息。

我已经检查了 NuGet 上的 Moodle 包,但是找不到任何内容。

你能否建议我如何实现这个界面?

提前致谢。

2个回答

2

谢谢,我已经尝试过了,似乎可以完成任务。 - Si Blight
这里有一个 Github 上的包装器:https://github.com/TvdLinden/MoodleApiWrapper ,还有一个 NuGet 包:http://www.nuget.org/packages/MoodleWrapper/。 - Marcel Studer

0

这段代码可以用于访问课程信息

 string result = "";
            string methodName = "GetCourse";                  
            string apiName = "core_course_get_courses";           
            string apiCall = moodleUrl + "?wstoken=" + token + "&wsfunction=" + apiName + "&moodlewsrestformat=json";

            try
            {
                using (WebClient client = new WebClient())
                {
                    client.BaseAddress = apiCall;
                    client.Headers[HttpRequestHeader.Accept] = "application/json";
                    result = client.DownloadString(apiCall);

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接