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

New Web Service core_question_update_flag

    XMLWordPrintable

    Details

    • Testing Instructions:
      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.
    • Affected Branches:
      MOODLE_30_STABLE
    • Fixed Branches:
      MOODLE_31_STABLE
    • Pull Master Branch:
      MDL-53409-master

      Description

      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

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              pferre22 Pau Ferrer
              Reporter:
              jleyva Juan Leyva
              Peer reviewer:
              Tim Hunt
              Integrator:
              David Monllaó
              Tester:
              Adrian Greeve
              Participants:
              Component watchers:
              Tim Hunt, Andrew Nicols, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Juan Leyva, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                23/May/16