Web services enrolment vs role_assign

Web services enrolment vs role_assign

by Nate Hartmann -
Number of replies: 3

I would like to populate our Moodle 2.0 with users, courses and enrollments from our student information system on demand.

I've set up XMLRPC web services, and successfully created users and courses using (moodle_user_create_users and moodle_course_create_courses respectively).

Is there a web service method for enrolling users in a course?

I did find the moodle_role_assign method (which does exactly what it says), but it only creates the mdl_role_assignments record, not the mdl_user_enrolments record.

Since MDL-22801 is marked fixed for 2.0, I figured this functionality would already be in core, and I'm just overlooking it.

If not, I will pursue Christian Pfisterer's local web services posted last November. Failing all else, I will fall back on an alternative enrolment method.

Thanks for any confirmation, denial or pointers.

-Nate

Average of ratings: -
In reply to Nate Hartmann

Re: Web services enrolment vs role_assign

by Jérôme Mouneyrac -

Hi Nate,

some web service enrolment functions are work in progress at the moment:

* MDL-26249 (http://tracker.moodle.org/browse/PULL-514)

* MDL-26250 (http://tracker.moodle.org/browse/PULL-515)

Hopefully we'll get all this in Moodle 2.0.X soon. Subscribe as watcher on the MDL issues to be alerted on any changes.

Jerome

Average of ratings: Useful (1)
In reply to Jérôme Mouneyrac

Re: Web services enrolment vs role_assign

by Nate Hartmann -

Thanks for the info and for your work Jerome!

In reply to Nate Hartmann

Re: Web services enrolment vs role_assign

by Dan Kennedy -

Hi Nate,

I'm really sorry to be "that guy", but are you able to post the code you use to create a user via XMLRPC?  I've been battling for hours trying to get the array structure correct (in PHP); it keeps throwing this back at me:

Invalid external api parameter: users (Only arrays accepted.)

Anyway, not your problem I know, I was just hoping someone could share their "create user" knowledge if they've already won the battle.

Cheers,
Dan