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

core_completion_update_activity_completion_status_manually

XMLWordPrintable

    • MOODLE_28_STABLE
    • MOODLE_29_STABLE
    • MDL-49444-master
    • Hide

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

      1. Enable completion at site level
      2. Create a course with a student, enable completion in the course settings.
      3. Create a couple of activities or resources, enable "Manually completion" for those activities
      4. Enable "Mobile services": Plugins ► Web Services ► Mobile
      5. Create a Token for 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 student user .
        • You need to replace the wstoken, cmid (activity cmid) and the URL of your moodle instance

           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 'cmid=74&completed=1&wsfunction=core_completion_update_activity_completion_status_manually&wstoken=a70d553bbaf6d9b260a9e5c701b3c46e' --compressed
          

      7. Confirm that
        • If you do a curl call with the parameter completed equal to 1 the activity is marked as complete in the course index for the user
        • If you do a curl call with the parameter completed equal to 0 the activity is marked as incomplete in the course index for the user
      Show
      Note: Version number is bumped because a new web service is added into the Mobile app service. Enable completion at site level Create a course with a student, enable completion in the course settings. Create a couple of activities or resources, enable "Manually completion" for those activities Enable "Mobile services": Plugins ► Web Services ► Mobile Create a Token for 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 student user . You need to replace the wstoken, cmid (activity cmid) and the URL of your moodle instance 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 'cmid=74&completed=1&wsfunction=core_completion_update_activity_completion_status_manually&wstoken=a70d553bbaf6d9b260a9e5c701b3c46e' --compressed Confirm that If you do a curl call with the parameter completed equal to 1 the activity is marked as complete in the course index for the user If you do a curl call with the parameter completed equal to 0 the activity is marked as incomplete in the course index for the user

      This WS will do what /course/ -> togglecompletion.php does but only for activities.

      It will change the user completion status for an activity, this is used when manual completion for that activity is enabled

            jleyva Juan Leyva
            jleyva Juan Leyva
            Dani Palou Dani Palou
            David Monllaó David Monllaó
            Damyon Wiese Damyon Wiese
            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.