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

Create a new endpoint (script) to retrieve draft files from web services

XMLWordPrintable

    • MOODLE_310_STABLE
    • MOODLE_311_STABLE
    • MDL-70128-master
    • Hide
      1. As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      2. Create a Token in the mobile app service for any user in the site (not an admin account)
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      3. With any text editor, create a new .txt file named "drafttest.txt" it can have any random content
      4. Now, log in with the user you created the token for
      5. Go to Private files
      6. Upload the "draftest.txt" file DO NOT click Save changes yet
      7. Now, you need to extract the download URL for that file, in order to do this you can:
        • Enable the browser Developer tools, activating the Network tab
        • Click on the "drafttest.txt" file in the browser and click the Download button
        • In the network tab you will see the URL used for downloading the file, copy the URL, it should have a format like: http://YOURSITE/draftfile.php/XX/user/draft/YY/drafttest.txt
      8. Now, create a new URL by:
      9. Now, copy the previous new URL in a browser where you are not authenticated with any user and confirm that:
        • The drafttest.txt file is downloaded from the server
        • The contents of the file are ok/correct
      Show
      As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings Create a Token in the mobile app service for any user in the site (not an admin account) Click on Site administration ► Plugins ► Web services ► Manage tokens With any text editor, create a new .txt file named "drafttest.txt" it can have any random content Now, log in with the user you created the token for Go to Private files Upload the "draftest.txt" file DO NOT click Save changes yet Now, you need to extract the download URL for that file, in order to do this you can: Enable the browser Developer tools, activating the Network tab Click on the "drafttest.txt" file in the browser and click the Download button In the network tab you will see the URL used for downloading the file, copy the URL, it should have a format like: http://YOURSITE/draftfile.php/XX/user/draft/YY/drafttest.txt Now, create a new URL by: Appending at the end the following: ?token=TOKEN_FROM_STEP_2 Adding "webservice/" just before draftfile.php Example: http://YOURSITE/webservice/draftfile.php/XX/user/draft/YY/drafttest.txt?tokenn=XYZ Now, copy the previous new URL in a browser where you are not authenticated with any user and confirm that: The drafttest.txt file is downloaded from the server The contents of the file are ok/correct

      For supporting draft files edition via a Rich Text Editor in the app (when editing an element like a forum post, etc...), we need a way to manage and get files in a draft state for the user.

      We have to create and endpoint so Web Services can retrieve user draft files, right now is not possible because webservice/pluginfile.php does not allow to retrieve draft files.

            jleyva Juan Leyva
            jleyva Juan Leyva
            Dani Palou Dani Palou
            Adrian Greeve Adrian Greeve
            Janelle Barcega Janelle Barcega
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 3 hours, 20 minutes
                3h 20m

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