Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-29934 Web service API Roadmap
  3. MDL-50139

mod_choice_submit_choice_response

    XMLWordPrintable

    Details

    • Type: Sub-task
    • Status: Closed
    • Priority: Minor
    • Resolution: Won't Fix
    • Affects Version/s: 3.0
    • Fix Version/s: None
    • Component/s: Choice, Web Services
    • Labels:
    • Testing Instructions:
      Hide

      Note: Version number is bumped because a new web service is added into the Mobile app service.

      1. create a course with a choice/activity
      2. create 3 possible options for this choice
      3. enroll student1 to this course
      4. As student1 call mod_choice_sumbit_choice_response()
      5. using a curl call as in the following example:
      1. Create a Token for the Student1:
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      2. Next, you can do a couple of CURL REST call simulating a WS client as Student

      curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' -H 'Pragma: no-cache' -H 'Origin: file://' -H 'Accept-Encoding: gzip,deflate,sdch' -H 'Accept-Language: es,en;q=0.8,de-DE;q=0.6,de;q=0.4,nb;q=0.2' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1798.0 Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' -H 'Accept: application/json, text/javascript, /; q=0.01' -H 'Cache-Control: no-cache' -H 'Connection: keep-alive' --data 'wsfunction=mod_choice_submit_choice_response&choiceinstanceid=1&responses[]=3&wstoken=19d196c6b5e94efb8c84dd534c1f9018' --compressed

      1. The webservice should return this kind of result:

      {"answers":[{"id":12,"choiceid":1,"userid":8,"optionid":3,"timemodified":1433516029}],"warnings":[]}
      

      1. For each response you successfully submitted you will receive back those records the
        webservice just added into the answers table.
      Show
      Note: Version number is bumped because a new web service is added into the Mobile app service. create a course with a choice/activity create 3 possible options for this choice enroll student1 to this course As student1 call mod_choice_sumbit_choice_response() using a curl call as in the following example: Create a Token for the Student1: Click on Site administration ► Plugins ► Web services ► Manage tokens Next, you can do a couple of CURL REST call simulating a WS client as Student curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' -H 'Pragma: no-cache' -H 'Origin: file:// ' -H 'Accept-Encoding: gzip,deflate,sdch' -H 'Accept-Language: es,en;q=0.8,de-DE;q=0.6,de;q=0.4,nb;q=0.2' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1798.0 Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' -H 'Accept: application/json, text/javascript, / ; q=0.01' -H 'Cache-Control: no-cache' -H 'Connection: keep-alive' --data 'wsfunction=mod_choice_submit_choice_response&choiceinstanceid=1&responses[]=3&wstoken=19d196c6b5e94efb8c84dd534c1f9018' --compressed The webservice should return this kind of result: {"answers":[{"id":12,"choiceid":1,"userid":8,"optionid":3,"timemodified":1433516029}],"warnings":[]} For each response you successfully submitted you will receive back those records the webservice just added into the answers table.
    • Affected Branches:
      MOODLE_30_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-50139-master

      Description

      Submit a choice response.

      submit_choice_response(choiseinstanceid, array of responses)
      Use core API choice_user_submit_response

        Attachments

          Activity

            People

            • Assignee:
              ccito Costantino Cito
              Reporter:
              jleyva Juan Leyva
              Participants:
              Component watchers:
              Dan Marsden, Jake Dallimore, Jun Pataleta, Ryan Wyllie, Juan Leyva, Jake Dallimore, Jun Pataleta, Ryan Wyllie
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: