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

New Web Service mod_feedback_get_last_completed

XMLWordPrintable

    • MOODLE_32_STABLE
    • MOODLE_33_STABLE
    • MDL-57813-master
    • Hide
      1. Create or use an existing feedback (configured to not be anonymous) with at least two questions in one unique page.
      2. Complete the feedback with one student account.
      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, feedbackid (the feedback instance value) and the URL of your moodle instance.

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

      1. Confirm that you receive an structure that match the completion record for the user in the database (feedback_completed table)
      2. Using a WS Token for a student that didn't complete the feedback, execute the curl request, you should get a not_completed_yet exception
      3. Create a new feedback configured to be anonymous
      4. Take the feedback again with a student user account
      5. Execute the curl request using the new student user WS token and feedback id and check that you receive an "anonymous" exception
      6. If you execute again the curl request using a wstoken of a user who didn't complete the feedback you will get the same exception "anonymous"
      Show
      Create or use an existing feedback (configured to not be anonymous) with at least two questions in one unique page. Complete the feedback with one student account. 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, feedbackid (the feedback instance value) and the URL of your moodle instance. curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'feedbackid=12&wsfunction=mod_feedback_get_last_completed&wstoken=12a2a65aeea2a177055e233f9e303218&moodlewssettingfilter=true' | python -m "json.tool" Confirm that you receive an structure that match the completion record for the user in the database (feedback_completed table) Using a WS Token for a student that didn't complete the feedback, execute the curl request, you should get a not_completed_yet exception Create a new feedback configured to be anonymous Take the feedback again with a student user account Execute the curl request using the new student user WS token and feedback id and check that you receive an "anonymous" exception If you execute again the curl request using a wstoken of a user who didn't complete the feedback you will get the same exception "anonymous"

      Return the last feedback completed by the user (empty for anonymous)

            jleyva Juan Leyva
            jleyva Juan Leyva
            Pau Ferrer Pau Ferrer
            Jake Dallimore Jake Dallimore
            Ankit Agarwal Ankit Agarwal
            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.