H5P and Moodle: Can I store and retrieve files (e.g. JSON) on the moodle server from the Javascript in H5P

Forums: 

Hi,

I want to write an H5P-App retrieving some data from the moodle-filesystem and displaying it to the user. At the end of the process, the data will be uploaded again to the server. (I want to create an individual formular for the user to store structured data)

Do you understand me?

The question is: How do I download and upload files from the Javacript in H5P? Over JQuery?

Thanks, best

Thomas

 

 

otacke's picture

Hi Thomas!

If you want to do that, you will need to establish endpoints on your server (or reuse moodle endpoints if it has any that you could utilize to access the file system) that the JavaScript client can talk to via AJAX in order to retrieve and to store data.

If you bind that to moodle, however, you completely defeat the purpose of H5P which is meant to run on any platform without particular dependencies to components running on some platform only but not on others. You may want to check whether you're not better off by creating a moodle plugin to server your needs.

Best,
Oliver