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

New Web Service mod_lesson_finish_attempt

XMLWordPrintable

    • MOODLE_32_STABLE
    • MOODLE_33_STABLE
    • MDL-57724-master
    • Hide
      1. In a course create a lesson with at least two content pages. Configure the lesson to display the progress bar.
      2. Enrol one user as student in the course where the lesson is.
      3. Access to the lesson as student in the Moodle web interface, and visit the two pages.
      4. As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      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), p

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

      1. Now check that you don't see any warnings, see the correct progress value (matching the one in the web inteface for the lesson) and you see several information in the "data" field like welldone set to 1, the progresscompleted set to the same value than web and in gradeinfo you see that the lesson didn't have questions.
      Show
      In a course create a lesson with at least two content pages. Configure the lesson to display the progress bar. Enrol one user as student in the course where the lesson is. Access to the lesson as student in the Moodle web interface, and visit the two pages. As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings 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), p curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'lessonid=4&wsfunction=mod_lesson_finish_attempt&wstoken=12a2a65aeea2a177055e233f9e303218&moodlewssettingfilter=true' | python -m "json.tool" Now check that you don't see any warnings, see the correct progress value (matching the one in the web inteface for the lesson) and you see several information in the "data" field like welldone set to 1, the progresscompleted set to the same value than web and in gradeinfo you see that the lesson didn't have questions.

      Finish an existing attempt, this usually happens when the user reach the lesson EOL page or when the timer is off

            jleyva Juan Leyva
            jleyva Juan Leyva
            Dani Palou Dani Palou
            David Monllaó David Monllaó
            David Monllaó David Monllaó
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

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