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

New Web Service mod_lesson_get_pages

XMLWordPrintable

    • MOODLE_32_STABLE
    • MOODLE_33_STABLE
    • MDL-57685-master
    • Hide
      1. In a course create a lesson with at least one content page and one question page. Configure the lesson to show the menu (Display menu option)
      2. Enrol one user as student in the course where the lesson is.
      3. As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      4. Create a Token for the student user
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      5. 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_pages&wstoken=12a2a65aeea2a177055e233f9e303218&moodlewssettingfilter=true' | python -m "json.tool"

      6. Confirm that you receive correctly the list of pages, check that you see the content page titles (you see only the titles of content pages, no question pages)
      7. Now, as admin edit the lesson and disable the "Display menu" option
      8. Execute the curl request again and check that you don't see page titles anymore
      Show
      In a course create a lesson with at least one content page and one question page. Configure the lesson to show the menu (Display menu option) Enrol one user as student in the course where the lesson is. 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) 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_pages&wstoken=12a2a65aeea2a177055e233f9e303218&moodlewssettingfilter=true' | python -m "json.tool" Confirm that you receive correctly the list of pages, check that you see the content page titles (you see only the titles of content pages, no question pages) Now, as admin edit the lesson and disable the "Display menu" option Execute the curl request again and check that you don't see page titles anymore

      Return a complete list of the pages in a lesson (just the basic information, excluding contents) so external clients (like the mobile app) can print the lesson menu and calculate the amount of information to download.

            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:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

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