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

Add filesize as a new field returned in all the Web Services returning file information

XMLWordPrintable

    • MOODLE_31_STABLE, MOODLE_32_STABLE
    • MOODLE_32_STABLE
    • MDL-54941-master
    • Hide

      The best way to check that everything is working after the refactor is via the Mobile app, in the Moodle site:

      • Create a forum post with attachments
      • Create a glossary entry with attachments
      • Create an assignment including attachments in the description (attached files, not in the description editor)

      Connect with the app to the site and check that you can see the glossary, forum and assignment attachments correctly.

      To check that now you can view the attached files size:

      1. As admin, enable "Mobile services": Plugins ► Web Services ► Mobile
      2. Create a Token for one user in the course where the forum with attachments is:
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      3. Next, you can do a CURL REST call simulating a WS client with the user.
        • You need to replace the wstoken, discussionid (the discussion id of the post with attachments) and the URL of your moodle instance

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'discussionid=X&wsfunction=mod_forum_get_forum_discussion_posts&wstoken=ffbe3a3002f235bf9d01fd9369e10b66&moodlewssettingfilter=true'| python -m "json.tool"

      4. Now check that you can see the attachments including the file size
      Show
      The best way to check that everything is working after the refactor is via the Mobile app, in the Moodle site: Create a forum post with attachments Create a glossary entry with attachments Create an assignment including attachments in the description (attached files, not in the description editor) Connect with the app to the site and check that you can see the glossary, forum and assignment attachments correctly. To check that now you can view the attached files size: As admin, enable "Mobile services": Plugins ► Web Services ► Mobile Create a Token for one user in the course where the forum with attachments is: 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, discussionid (the discussion id of the post with attachments) and the URL of your moodle instance curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'discussionid=X&wsfunction=mod_forum_get_forum_discussion_posts&wstoken=ffbe3a3002f235bf9d01fd9369e10b66&moodlewssettingfilter=true'| python -m "json.tool" Now check that you can see the attachments including the file size

      We need this field to calculate the size of all the information to be downloaded via the Mobile app. Reason is that we want to implement a pre-fetch (download) of all the activities data so the user can do the activity offline.

        1. app view.PNG
          app view.PNG
          27 kB
        2. web view.PNG
          web view.PNG
          60 kB

            jleyva Juan Leyva
            jleyva Juan Leyva
            Ryan Wyllie Ryan Wyllie
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            cameron1729 cameron1729
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.