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

New Web Service mod_lesson_get_lesson

    XMLWordPrintable

Details

    • New Feature
    • Resolution: Fixed
    • Minor
    • 3.3
    • 3.2.2
    • Lesson, Web Services
    • MOODLE_32_STABLE
    • MOODLE_33_STABLE
    • MDL-58329-master
    • Hide
      1. Create one lesson activity protected with password in a course with a teacher and student enrolled.
      2. Add a media file to the lesson and some images in the lesson description.
      3. Enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      4. Create a Token for one teacher and one student enrolled in the course:
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      5. 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, lessonid and the URL of your moodle instance. You must replace the password also

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

          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

      6. Confirm that
        • As student you see all the database lesson fields except 'password', 'dependency', 'conditions', 'activitylink', 'available', 'deadline', 'timemodified', 'completionendreached', 'completiontimespent'. You should also see all the files you attached.
        • As a teacher you see all the lesson database fields even if you use an incorrect password
      Show
      Create one lesson activity protected with password in a course with a teacher and student enrolled. Add a media file to the lesson and some images in the lesson description. Enable "Mobile services": Site administration ► Mobile app ► Mobile settings Create a Token for one teacher and one student enrolled in the course: 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, lessonid and the URL of your moodle instance. You must replace the password also curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'lessonid=7&wsfunction=mod_lesson_get_lesson&password=123&wstoken=12a2a65aeea2a177055e233f9e303218&moodlewssettingfilter=true' | python -m "json.tool" 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 As student you see all the database lesson fields except 'password', 'dependency', 'conditions', 'activitylink', 'available', 'deadline', 'timemodified', 'completionendreached', 'completiontimespent'. You should also see all the files you attached. As a teacher you see all the lesson database fields even if you use an incorrect password

    Description

      Retrieve the information from a given lesson

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved:

                Clockify

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