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

New Web Service mod_lesson_get_page_data

XMLWordPrintable

    • MOODLE_32_STABLE
    • MOODLE_33_STABLE
    • MDL-57693-master
    • Hide
      1. In a course create a lesson with at least one content page and one question page, and with the Appearance -> Progress bar value set to Yes.
      2. Enrol one user as student in the course where the lesson is.
      3. As student access to the lesson (just view the first pageid)
      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), pageid with the lesson first page id and the URL of your moodle instance

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'lessonid=13&pageid=96&returncontents=1&wsfunction=mod_lesson_get_page_data&wstoken=12a2a65aeea2a177055e233f9e303218&moodlewssettingfilter=true' | python -m "json.tool"

      7. Confirm that you receive all the page information, including title and contents, you receive also the pagecontents that matches the Moodle rendered content for the page.
      8. Check if that you progress in the lesson via the web interface, the progress field is update in further curl requests.
      Show
      In a course create a lesson with at least one content page and one question page, and with the Appearance -> Progress bar value set to Yes. Enrol one user as student in the course where the lesson is. As student access to the lesson (just view the first pageid) 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), pageid with the lesson first page id and the URL of your moodle instance curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'lessonid=13&pageid=96&returncontents=1&wsfunction=mod_lesson_get_page_data&wstoken=12a2a65aeea2a177055e233f9e303218&moodlewssettingfilter=true' | python -m "json.tool" Confirm that you receive all the page information, including title and contents, you receive also the pagecontents that matches the Moodle rendered content for the page. Check if that you progress in the lesson via the web interface, the progress field is update in further curl requests.

      Return information of a given page, including its contents, the ongoing status, lesson progress and related area files.

      This function is similar to mod_quiz_get_attempt_data, it is returning the questions (if any) already rendered.

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

              Created:
              Updated:
              Resolved:

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