I'm currently a student at a University and I'm using Moodle everyday. I would like to access some information that is available to me (For example, information of the classes I'm taking, Which assignments are due and when , etc)
I did some research regarding Moodle's API but it all seemed geared toward the power user who actually runs Moodle (My University).
Is there an easy way for me as a student to get the information?
My application uses Node.js
If your university has enabled Web Services for the mobile app, you can generate your own API token and call the Web Services used by the mobile app. If the latter are not enabled, you have to get in touch with your administrator to get Web Services access.
Demo using moodle.org
First, let's get an API token (replace
$PASSWORD
with your password):Next, we need your
userid
, it will be used throughout other web services call. You can obtain youruserid
by calling the web servicecore_webservice_get_site_info
. Make sure to replace$TOKEN
with the token you obtained above.Now that you have your
userid
, we can request the courses that you are enrolled in.Recap'
Pre-requisites:
Querying:
YOURHOST/webservice/rest/server.php?moodlewsrestformat=json
.POST
requestswstoken
: Your tokenwsfunction
: The function you are callingapplication/x-www-form-urlencoded
More
I've greatly simplified how this works and what alternatives there are, but this should get you started. You will likely be interested in looking at the developer documentation to get more information about the available web services: