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

New Web Services mod_wiki_view_wiki and mod_wiki_view_page

XMLWordPrintable

    • MOODLE_29_STABLE
    • MOODLE_31_STABLE
    • MDL-51886-master
    • Hide

      Note: Version number is bumped because new web services are added into the Mobile app service and to the mod_wiki list of external functions.

      1. Create a course with a student, the course must have at least one section.
      2. Enable completion at site level and course level.
      3. Create a mod_wiki activity.
        • Use as completion criteria "Student must view this activity to complete it".
      4. As admin, enable "Mobile services": Plugins ► Web Services ► Mobile
      5. Create a Token for the student user.
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      6. Next, you can do a CURL REST call simulating a WS client with the student user .
        • You need to replace the wstoken, wikiid (the wiki instance value) and the URL of your moodle instance.

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wikiid=1&wsfunction=mod_wiki_view_wiki&wstoken=5b6154a56566a194f60f7f395f235179' --compressed

      7. Confirm that:
        • As a teacher, you can see new entries in the course log (wiki course module viewed) for that course and the user. The origin for the new log entries is "ws".
        • If you access via the web interface as that student you will see the activity marked as completed. If you access the wiki via the web interface with the student you will be able to see log entries with origin "web" (wiki course module viewed) as a teacher.
          NOTE: If you don't see the activity marked as completed you should logout and login again, Moodle session cache sometimes does not upgrade the completion status for activities.
      8. Let's test view_page WS now. We'll test completion again, so you'll need to do one of these options:
        • Disable completion on the wiki and enable it again so it's resetted.
        • Create a new wiki with completion enabled and criteria "Student must view this activity to complete it".
      9. Create a page on the wiki if you haven't done it before.
      10. Next, you can do a CURL REST call simulating a WS client with the student user.
        • You need to replace the wstoken, pageid and the URL of your moodle instance.

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'pageid=1&wsfunction=mod_wiki_view_page&wstoken=5b6154a56566a194f60f7f395f235179' --compressed

      11. Confirm that:
        • As a teacher, you can see new entries in the course log (wiki page viewed) for that course and the user. The origin for the new log entries is "ws".
        • If you access via the web interface as that student you will see the activity marked as completed.
          NOTE: If you don't see the activity marked as completed you should logout and login again, Moodle session cache sometimes does not upgrade the completion status for activities.
      Show
      Note: Version number is bumped because new web services are added into the Mobile app service and to the mod_wiki list of external functions. Create a course with a student, the course must have at least one section. Enable completion at site level and course level. Create a mod_wiki activity. Use as completion criteria "Student must view this activity to complete 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 Next, you can do a CURL REST call simulating a WS client with the student user . You need to replace the wstoken, wikiid (the wiki instance value) and the URL of your moodle instance. curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wikiid=1&wsfunction=mod_wiki_view_wiki&wstoken=5b6154a56566a194f60f7f395f235179' --compressed Confirm that: As a teacher, you can see new entries in the course log (wiki course module viewed) for that course and the user. The origin for the new log entries is "ws". If you access via the web interface as that student you will see the activity marked as completed. If you access the wiki via the web interface with the student you will be able to see log entries with origin "web" (wiki course module viewed) as a teacher. NOTE: If you don't see the activity marked as completed you should logout and login again, Moodle session cache sometimes does not upgrade the completion status for activities. Let's test view_page WS now. We'll test completion again, so you'll need to do one of these options: Disable completion on the wiki and enable it again so it's resetted. Create a new wiki with completion enabled and criteria "Student must view this activity to complete it". Create a page on the wiki if you haven't done it before. Next, you can do a CURL REST call simulating a WS client with the student user. You need to replace the wstoken, pageid and the URL of your moodle instance. curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'pageid=1&wsfunction=mod_wiki_view_page&wstoken=5b6154a56566a194f60f7f395f235179' --compressed Confirm that: As a teacher, you can see new entries in the course log (wiki page viewed) for that course and the user. The origin for the new log entries is "ws". If you access via the web interface as that student you will see the activity marked as completed. NOTE: If you don't see the activity marked as completed you should logout and login again, Moodle session cache sometimes does not upgrade the completion status for activities.

      This function will trigger the module view event and call completion API.

            dpalou Dani Palou
            dpalou Dani Palou
            Simey Lameze Simey Lameze
            David Monllaó David Monllaó
            Rajesh Taneja Rajesh Taneja
            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.