Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-50350

New Web Service mod_scorm_get_scorm_attempts

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Won't Fix
    • Icon: Minor Minor
    • None
    • 2.9
    • SCORM, Web Services
    • MOODLE_29_STABLE
    • MDL-50350-master
    • Hide

      Note: Version numbers are bumped because a new web service is added into the Mobile app service and also in a module.

      1. Create a course with a teacher and a student.
      2. Create a sample scorm activity, you should use the singlescobasic.zip found here https://github.com/moodle/moodle/tree/master/mod/scorm/tests/packages.
      3. As the student, access the scorm package and start a couple of attempts (don't forget to select the start new attempt option).
      4. Enable "Mobile services": Plugins ► Web Services ► Mobile
      5. Create a Token for the teacher and the student:
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      6. Next, you can do a couple of CURL REST call simulating a WS client with the teacher and the student user .
        • You need to replace the wstoken, scormid (scorm instance id), userid and the URL of your moodle instance

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'scormid=2&userid=106&wsfunction=mod_scorm_get_scorm_attempts&wstoken=a70d553bbaf6d9b260a9e5c701b3c46e'

          Note, you can use jsonlint.com to validate and format the json returned string or append "| python -m json.tool" to automatically format the command output

      7. Confirm that
        • You receive as response an array containing all the attempts ids
        • If using the student token you try to retrieve other student attempts you got a required_capability_exception
        • With the teacher token you can see all the course students attempts
        • If you try to retrieve attempts for a nonexistent scorm or user you get invalidrecord and invaliduser errors
      Show
      Note: Version numbers are bumped because a new web service is added into the Mobile app service and also in a module. Create a course with a teacher and a student. Create a sample scorm activity, you should use the singlescobasic.zip found here https://github.com/moodle/moodle/tree/master/mod/scorm/tests/packages . As the student, access the scorm package and start a couple of attempts (don't forget to select the start new attempt option). Enable "Mobile services": Plugins ► Web Services ► Mobile Create a Token for the teacher and the student: Click on Site administration ► Plugins ► Web services ► Manage tokens Next, you can do a couple of CURL REST call simulating a WS client with the teacher and the student user . You need to replace the wstoken, scormid (scorm instance id), userid and the URL of your moodle instance curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'scormid=2&userid=106&wsfunction=mod_scorm_get_scorm_attempts&wstoken=a70d553bbaf6d9b260a9e5c701b3c46e' Note, you can use jsonlint.com to validate and format the json returned string or append "| python -m json.tool" to automatically format the command output Confirm that You receive as response an array containing all the attempts ids If using the student token you try to retrieve other student attempts you got a required_capability_exception With the teacher token you can see all the course students attempts If you try to retrieve attempts for a nonexistent scorm or user you get invalidrecord and invaliduser errors

      Parameters: scormid and userid
      Returns: A list containing information of all the attempts done by the specified user id
      This will be used to know the current attempt status for the user (last attempt, etc..)

            jleyva Juan Leyva
            jleyva Juan Leyva
            Ankit Agarwal Ankit Agarwal
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.