Enroll user to courses using webservice

Enroll user to courses using webservice

by Swapnil Gaikwad -
Number of replies: 1

Hi all,

I want to enroll user to course using web service,

currently i am using ( $enrolment->roleid = $role_id; $enrolment->userid = $user_id;$enrolment->courseid = $course_id; )as a array parameters and its working fine.

but i want to enroll user using course ID number instead of courseid  ( $enrolment->roleid = $role_id; $enrolment->userid = $user_id;$enrolment->idnumber = $idnumber; ) these parameter gets error.

is this possible to use these parameter?

Average of ratings: -
In reply to Swapnil Gaikwad

Re: Enroll user to courses using webservice

by Dorel Manolescu -
Picture of Plugin developers

Hi

Unless you find a better solution you can use as a work-around an additional step with this web-service:

###########################


Get courses matching a specific field (id/s, shortname, idnumber, category)


Arguments
field (Default to "")
        The field to search can be left empty for all courses or: id: course id ids: comma separated course ids shortname: course short name idnumber: course id number category: category id the course belongs to 

General structure
string Default to "" //The field to search can be left empty for all courses or: id: course id ids: comma separated course ids shortname: course short name idnumber: course id number category: category id the course belongs to
#################

to get the course id once you have the course idnumber.

Regards