将Moodle数据作为JSON获取


Getting Moodle Data as JSON

我想把从课程到测验再到流媒体链接的所有moodle数据都作为JSON获取。

我遵循了API文档,获得了令牌,但之后在哪里以及如何使用此令牌?

例如,如果我想获得课程列表,那么我该怎么做呢?如果有人可以分享一些例子。

步骤1:激活moodle中的Web服务。以下是步骤:http://docs.moodle.org/dev/Creating_a_web_service_client

http://<your_domain>/webservice/rest/server.php?wstoken=<your_token>&wsfunction=<your_function_name>

要以json形式返回响应,可以添加&moodlewsrestformat=json

http://<your_domain>/webservice/rest/server.php?wstoken=<your_token>&wsfunction=<your_function_name>&moodlewsrestformat=json

步骤1:激活moodle中的Web服务。以下是步骤:http://docs.moodle.org/dev/Creating_a_web_service_client

第2步:阅读API文档。这可在网站管理->插件->web服务->API文档中找到。这只对管理员用户可用。例如,您想要的任务是获取课程列表,正确的API是"core_course_get_courses"。API文档提供了所有可用功能的详细信息。