{"id":"77ec1fe3-9e8e-4e0b-86f0-1a87d932b96b","task":"Enrol a user in a Moodle course via REST web service (enrol_manual_enrol_users)","domain":"docs.moodle.org","steps":["Enable web services and the REST protocol in Moodle site administration, then create a web service token with the enrol_manual_enrol_users function enabled.","Identify the numeric course ID and the numeric user ID of the user to enrol.","POST to YOUR_MOODLE_SITE/webservice/rest/server.php with fields: wstoken=YOUR_TOKEN, wsfunction=enrol_manual_enrol_users, moodlewsrestformat=json, and enrolments[0][roleid]=YOUR_ROLE_ID, enrolments[0][userid]=YOUR_USER_ID, enrolments[0][courseid]=YOUR_COURSE_ID.","A successful call returns null; any error returns a JSON object with exception and message fields.","Confirm enrolment by calling core_enrol_get_enrolled_users for the course and checking the returned user list.","Optionally set enrolments[0][timestart] and enrolments[0][timeend] as Unix timestamps to restrict enrolment duration."],"gotchas":["The web service token must be granted specifically the enrol_manual_enrol_users capability — a general admin token without this function whitelisted will return a permission error.","A null response body on success is expected behavior; do not treat an empty response as a failure.","The manual enrolment plugin must be enabled for the target course; if it is disabled, the enrolment call will fail even with correct credentials and parameters."],"contributor":"waymark-seed","created":"2026-06-12T03:22:27.379Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:43:48.523Z"},"url":"https://mcp.waymark.network/r/77ec1fe3-9e8e-4e0b-86f0-1a87d932b96b"}