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

New Web Service mod_quiz_get_quizzes_by_courses

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Fixed
    • Icon: Minor Minor
    • 3.1
    • 2.9
    • Quiz, Web Services
    • MOODLE_29_STABLE
    • MOODLE_31_STABLE
    • MDL-50546-master
    • Hide
      1. Bump your /version.php file to force Moodle to reload the Mobile service, alternatively you may run mdk run external_functions.php (to include the new external functions)
      2. Create a course with a teacher and a student.
      3. Create a couple of quizzes activities. Hide one of the activities.
      4. Enable "Mobile services": Plugins ► Web Services ► Mobile
      5. Create a Token for the teacher and the student:
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      6. 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, courseid and the URL of your moodle instance

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'courseids%5B0%5D=4&wsfunction=mod_quiz_get_quizzes_by_courses&wstoken=1b9cc9f44630b554bb2c9428b8744338'

          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

      7. Confirm that
        • As student you only see the visible quiz activity and all the settings fields except shuffleanswers', 'timecreated', 'timemodified', 'password' and'subnet'
        • As a teacher you see all the quiz activities and all the settings
      8. Now, add a time restriction to the quiz (for example, in the Time close add a passed date)
      9. As student, run the same CURL requests
      10. Confirm that now you can only see this fields 'id', 'coursemodule', 'course', 'name', 'intro', 'introformat', 'timeopen', 'timeclose', 'grademethod', 'section', 'visible', 'groupmode', 'groupingid'
      Show
      Bump your /version.php file to force Moodle to reload the Mobile service, alternatively you may run mdk run external_functions.php (to include the new external functions) Create a course with a teacher and a student. Create a couple of quizzes activities. Hide one of the activities. Enable "Mobile services": Plugins ► Web Services ► Mobile Create a Token for the teacher and the student: 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, courseid and the URL of your moodle instance curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'courseids%5B0%5D=4&wsfunction=mod_quiz_get_quizzes_by_courses&wstoken=1b9cc9f44630b554bb2c9428b8744338' 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 only see the visible quiz activity and all the settings fields except shuffleanswers', 'timecreated', 'timemodified', 'password' and'subnet' As a teacher you see all the quiz activities and all the settings Now, add a time restriction to the quiz (for example, in the Time close add a passed date) As student, run the same CURL requests Confirm that now you can only see this fields 'id', 'coursemodule', 'course', 'name', 'intro', 'introformat', 'timeopen', 'timeclose', 'grademethod', 'section', 'visible', 'groupmode', 'groupingid'

      Retrieve a list of quizzes from several courses

            jleyva Juan Leyva
            ccito Costantino Cito
            Tim Hunt Tim Hunt
            Andrew Lyons Andrew Lyons
            Jun Pataleta Jun Pataleta
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

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