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

New Web Service core_question_update_flag

XMLWordPrintable

    • MOODLE_30_STABLE
    • MOODLE_31_STABLE
    • MDL-53409-master
    • Hide
      1. Create a course with a student
      2. Add a Quiz and add some questions to it.
      3. As admin, enable "Mobile services": Plugins ► Web Services ► Mobile
      4. Create a Token for the student user.
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      5. As the user start and attempt of the quiz.
      6. Next, you can do a CURL REST call simulating a WS client with the student user.
        • You need to replace the wstoken and the URL of your moodle instance.
        • You may also change qubaid, questionid, qaid, slot and newstate.
        • To calculate the new checksum use an md5 generator with the following template: qubaid_usersecret_questionid_qaid_slot . Usually usersecret is empty.

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=core_question_update_flag&qubaid=1&questionid=1&qaid=1&slot=1&checksum=01b16b432969d727271ce46f60fbd868&newstate=1&wstoken=58705f1bb678fdbf57bdef94798830a5' --compressed

      7. Confirm that you receive the data of that request.
      8. Check that the question has been flagged.

      You can also check newstate to 0 and check that has been unflagged.

      Show
      Create a course with a student Add a Quiz and add some questions to it. As admin, enable "Mobile services": Plugins ► Web Services ► Mobile Create a Token for the student user. Click on Site administration ► Plugins ► Web services ► Manage tokens As the user start and attempt of the quiz. Next, you can do a CURL REST call simulating a WS client with the student user. You need to replace the wstoken and the URL of your moodle instance. You may also change qubaid, questionid, qaid, slot and newstate. To calculate the new checksum use an md5 generator with the following template: qubaid_usersecret_questionid_qaid_slot . Usually usersecret is empty. curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=core_question_update_flag&qubaid=1&questionid=1&qaid=1&slot=1&checksum=01b16b432969d727271ce46f60fbd868&newstate=1&wstoken=58705f1bb678fdbf57bdef94798830a5' --compressed Confirm that you receive the data of that request. Check that the question has been flagged. You can also check newstate to 0 and check that has been unflagged.

      We need a new web service as a wrapper of:
      question_flags::update_flag($qubaid, $questionid, $qaid, $slot, $checksum, $newstate);

      It will do the same that currently does the question/toogleflag.php AJAX script

            pferre22 Pau Ferrer
            jleyva Juan Leyva
            Tim Hunt Tim Hunt
            David Monllaó David Monllaó
            Adrian Greeve Adrian Greeve
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved:

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