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

New Web Service mod_lesson_get_questions_attempts

XMLWordPrintable

    • MOODLE_32_STABLE
    • MOODLE_33_STABLE
    • MDL-57648-master
    • Hide
      1. In a course create a lesson with at least one question page and configured to allow multiple attempts
      2. Enrol one user as student in the course where the lesson is.
      3. Attempt the lesson as the student a couple of times (please check as teacher that in the attempts report you see that the student did two attempts)
      4. As admin, enable "Mobile services": Plugins ► Web Services ► Mobile
      5. Create a Token for the student user
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      6. Next, you can do a CURL REST call simulating a WS client with the student user .
        • You need to replace the wstoken, lessonid (the lesson instance value) and the URL of your moodle instance

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'lessonid=8&wsfunction=mod_lesson_get_questions_attempts&wstoken=12a2a65aeea2a177055e233f9e303218&moodlewssettingfilter=true&attempt=0' | python -m "json.tool"

      7. Confirm that you receive all the questions attempts you did including your answers (if you did two attempts you will have to execute the web service two times incrementing the &attempt parameter value)
      Show
      In a course create a lesson with at least one question page and configured to allow multiple attempts Enrol one user as student in the course where the lesson is. Attempt the lesson as the student a couple of times (please check as teacher that in the attempts report you see that the student did two attempts) As admin, enable "Mobile services": Plugins ► Web Services ► Mobile Create a Token for the student user Click on Site administration ► Plugins ► Web services ► Manage tokens Next, you can do a CURL REST call simulating a WS client with the student user . You need to replace the wstoken, lessonid (the lesson instance value) and the URL of your moodle instance curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'lessonid=8&wsfunction=mod_lesson_get_questions_attempts&wstoken=12a2a65aeea2a177055e233f9e303218&moodlewssettingfilter=true&attempt=0' | python -m "json.tool" Confirm that you receive all the questions attempts you did including your answers (if you did two attempts you will have to execute the web service two times incrementing the &attempt parameter value)

      Return the list of page question attempts in a given lesson.

      Parameters:

      • retries: the lesson attempt number
      • pageid: to retrieve attempts only for the given page
      • correct: to retrieve only correct attempts
      • userid: to retrive only attempts for the given user

            jleyva Juan Leyva
            jleyva Juan Leyva
            Dani Palou Dani Palou
            Dan Poltawski Dan Poltawski
            Craig R Morton Craig R Morton
            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.