User enrolment via API/Web Service

User enrolment via API/Web Service

by Alan Quaino -
Number of replies: 1

Hi all,

I would like to know if it is possible to enroll a new user via API/Web Service. My aim is to enroll the student by giving username, password, firstname, lastname, cohort and some courses to enroll him to (as if it were done through a csv file). Moreover, I need to force the user to change his password at his first login.

I checked Enrolment API (https://docs.moodle.org/dev/Enrolment_API) but it seems there's nothing that can help me. I also noted that using DB queries to do that is not recommended.


Thank you in advance

Average of ratings: -
In reply to Alan Quaino

Re: User enrolment via API/Web Service

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Enrolling is just adding a user to a course (which would be web service function enrol_manual_enrol_users). However, it sounds like you want to create new user accounts. That is the job of authentication plugins. Look at some of the auth functions on https://docs.moodle.org/dev/Web_service_API_functions.
Average of ratings: Useful (1)