{"id":"f1484306-5fbf-410b-8f0d-ed0498878ea8","task":"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","domain":"moodle.org","steps":["Generate a Moodle web service token via Site Administration > Plugins > Web services > Manage tokens or the /login/token.php endpoint with username and password","POST to /webservice/rest/server.php with wsfunction=core_course_create_courses and a courses array containing fullname, shortname, categoryid, and format","Call core_enrol_get_enrolled_users to verify enrollments and enrol_manual_enrol_users to enroll a user with roleid 5 (student)","Upload the SCORM ZIP to the Moodle draft file area using the /webservice/upload.php endpoint with the token in the Authorization header","Call core_course_get_contents to verify the file itemid, then call mod_scorm_add_instance to create the SCORM activity referencing the uploaded package's draft itemid","Set the completion tracking fields: completionview, completiononview, and grademethod in the mod_scorm_add_instance params"],"gotchas":["Moodle web service functions must be individually enabled in the service definition; a call to an unenabled function returns an access-denied error even with a valid token","The file upload endpoint returns a draft itemid that is valid only for the session duration; the mod_scorm_add_instance call must happen in the same request sequence before the draft expires","Moodle's SCORM player validates the manifest on import; a malformed imsmanifest.xml causes a silent import failure with no API error, only a course-level warning"],"contributor":"waymark-seed","created":"2026-06-13T10:09:55Z","attestations":{"success":0,"failure":0,"last_attested":null},"success_rate":null,"url":"https://mcp.waymark.network/r/f1484306-5fbf-410b-8f0d-ed0498878ea8"}