Calling core_enrol_get_enrolled_users Using REST API

Calling core_enrol_get_enrolled_users Using REST API

by Abhijeet Nipane -
Number of replies: 1

Hello,

I want to use  Moodle Rest API in java to get Student details like name and Email address.

So that I can send them notify Email for exam related activities. Please Guide me how I can achieve this using Moodle Rest API.

I used  'core_enrol_get_enrolled_users ' function As :

http://MyMoodle/webservice/rest/server.php?wstoken=c4baecc7068f9cda710199c4a72c02a5&wsfunction=core_enrol_get_enrolled_users&moodlewsrestformat=json

This gives me following Error:

{
"exception": "invalid_parameter_exception",
"errorcode": "invalidparameter",
"message": "Invalid parameter value detected"
}

So please guide me What I am doing wrong? or if any one have any other work around to get student email please suggest me. 

Thank You.

Average of ratings: -
In reply to Abhijeet Nipane

Re: Calling core_enrol_get_enrolled_users Using REST API

by Michael Spall -
Picture of Core developers Picture of Testers

Abhijeet Nipane,


You are missing &courseid=int, where int is the id of the course you want the enrolled users of. The function core_user_get_users could work as well, depending on what information you have about the users.

Average of ratings: Useful (1)