by Juan Leyva.
The function core_course_get_contents returns:
- Modules in each section (activities or resources)
-- If the module is a resource it returns a list of the files used by this resource in the "contents" attribute
That attribute is an array of files, there you will have a fileurl attribute that is the downloadURL for the file (if you are using Web Services you should append the WS token)
Example of URL returned:
How you need to modify the URL to download the file:
Here you have a sample response of that WS:
https://github.com/moodlehq/moodlemobile/blob/master/emulator/core_course_get_contents.json
Cheers, Juan