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

New Web Service core_course_get_updates_since

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.2
    • Fix Version/s: 3.3
    • Component/s: Course, Web Services
    • Labels:
    • Testing Instructions:
      Hide
      1. Calculate your current timestamp before starting to do anything, you will need it later: http://www.epochconverter.com/
      2. In a course, as teacher do some modifications to some existing modules you can: change the settings of any module, add a new forum post, add a new glossary entry, wiki page add a new chapter to the book module etc... (please note that there are some modules not supported, like the database one)
      3. You can also enable the comments and rating feature in a glossary of forum and add new ratings or comments
      4. As admin, enable "Mobile services": Plugins ► Web Services ► Mobile
      5. Create a Token in the mobile app service for the teacher 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 user.
        • You need to replace the wstoken, courseid, add the timestamp (since parameter) and the URL of your moodle instance

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'courseid=X&since=1476274596&wsfunction=core_course_get_updates_since&wstoken=12a2a65aeea2a177055e233f9e303218' | python -m "json.tool"

      7. Check that the WS returns correctly the course module id and different areas of the module that were updated, in some cases you will receive itemids (like a new glossary entry id, or forum discussion post id) and in some cases when there are not itemids you will receive the last time when the module was updated.
      8. You may also see warnings if you course has modules that does not implement the check_updates "hook", like the database module, or workshop or lesson.
      Show
      Calculate your current timestamp before starting to do anything, you will need it later: http://www.epochconverter.com/ In a course, as teacher do some modifications to some existing modules you can: change the settings of any module, add a new forum post, add a new glossary entry, wiki page add a new chapter to the book module etc... (please note that there are some modules not supported, like the database one) You can also enable the comments and rating feature in a glossary of forum and add new ratings or comments As admin, enable "Mobile services": Plugins ► Web Services ► Mobile Create a Token in the mobile app service for the teacher user: Click on Site administration ► Plugins ► Web services ► Manage tokens Next, you can do a CURL REST call simulating a WS client with the user. You need to replace the wstoken, courseid, add the timestamp (since parameter) and the URL of your moodle instance curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'courseid=X&since=1476274596&wsfunction=core_course_get_updates_since&wstoken=12a2a65aeea2a177055e233f9e303218' | python -m "json.tool" Check that the WS returns correctly the course module id and different areas of the module that were updated, in some cases you will receive itemids (like a new glossary entry id, or forum discussion post id) and in some cases when there are not itemids you will receive the last time when the module was updated. You may also see warnings if you course has modules that does not implement the check_updates "hook", like the database module, or workshop or lesson.
    • Affected Branches:
      MOODLE_32_STABLE
    • Fixed Branches:
      MOODLE_33_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-57395-master

      Description

      In order to re-use the current check_updates API at module level, we could create a new function for retrieving all the course updates since a given date.

      Right now, there is a core_course_check_updates function but checks module by module (not the whole course)

      Parameters would be:
      courseid
      since - Check updates since this time stamp
      filter- Check only for updates in the given areas

        Attachments

          Activity

            People

            Assignee:
            jleyva Juan Leyva
            Reporter:
            jleyva Juan Leyva
            Peer reviewer:
            Ankit Agarwal
            Integrator:
            Dan Poltawski
            Tester:
            Adrian Greeve
            Participants:
            Component watchers:
            Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Juan Leyva, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              15/May/17