Automated update of the file resource via webservice

Automated update of the file resource via webservice

by Stephan Robotta -
Number of replies: 1

Here's another pitch that I would like to promote for development.

With the file resource a teacher may upload a zip file containing a self contained site (e.g. created from a static site generator) that contains the course material for the students.

At the moment this is possible in manual steps:

  1. Create a File activity
  2. Upload the zip archive
  3. Extract the ZIP file in the activity
  4. Set the main file to index.html (or whatever the entry point is)
When the material needs to be updated (e.g. fixing a typo, exchanging or adding an image), the steps 2. and 3. from above need to be repreated after the site generator has created the whole site again.

My proposal is to have a plugin that offers a webservice that can handle the steps from above. In this way the upload process to Moodle can be included as a post step in the sitegenerator in the same way as if you would update the github[pages].

The webservice needs:
  • the course id
  • the activity id/name (if it does not exist, it could be created automatically)
  • a token (that identifies the user)
  • define the enty point (one filename inside the zip archive) -> see step 4 above

In reply to Stephan Robotta

Re: Automated update of the file resource via webservice

by Alistair Spark -
Just to say the APIs for this already exist in Moodle. File Handling is an advanced topic with the draft file, etc status transitions which does throw even very experienced Moodle devs.

 However, I think this would probably be ideally suited as a Github Actions Workflow where you can sync the files from your repo with the activity files in the course