I'm experimenting with Moodle Web services in order to call Moodle from a Joomla front-end. One thing I need to do is to write scripts that enable our tutors to define a user, then set their rôle, and then, perhaps quite a time later, attach these users to courses that a tutor has created. Creating users is OK, but there's something I need for creating rôles.
Which is that the Web-service function moodle_role_assign needs a rôle ID parameter. But how can I get the IDs of rôles that have already been added to the system? Our installation has rôles Manager, Teacher, Non-editing Teacher, and Student (amongst others), which are the ones I want to give to new users. But I can't find any way to list their IDs from Moodle's administrator's interface, nor can I see a Web-service function that would return the IDs. I suppose I'd need a function such as moodle_role_get_id, which would take the name or short name of a rôle and return its ID.
Likewise, how do I get the IDs of existing contexts? I'd like to do all this without hacking Moodle, i.e. by calling only the Web services. I'm using Moodle 2.0.1 at the moment.