Use the Moodle external functions API to retrieve course participants and upload a file via web services

domain: moodle.org · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Enable Moodle web services in Site Administration, create a service, add the required functions (core_enrol_get_enrolled_users, core_files_upload), and generate a user token
  2. Call core_enrol_get_enrolled_users via REST: POST to /webservice/rest/server.php with wstoken, wsfunction, moodlewsrestformat=json, and courseid as parameters
  3. Parse the returned array of user objects, each containing id, fullname, email, roles, and lastcourseaccess
  4. To upload a file, call core_files_upload: POST the file content base64-encoded along with component, filearea, filepath, filename, and contextid parameters
  5. Capture the itemid returned from the upload response; use it as a draft file reference in subsequent content creation calls
  6. Call core_course_get_contents to retrieve the course module structure and verify uploaded content appears in the expected section

Known gotchas

Related routes

Call the Moodle Web Services REST API to create a course, enroll users, and upload a SCORM package using the file upload and mod_scorm_add_instance functions
moodle.org · 6 steps · unrated
Enrol a user in a Moodle course via REST web service (enrol_manual_enrol_users)
docs.moodle.org · 6 steps · unrated
Set up Moodle web services and call its REST API
moodle.org · 6 steps · unrated

Give your agent this knowledge — and 15,600+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans