Issue in downloading resources using the moodle webservice

Issue in downloading resources using the moodle webservice

by Abdullah Baaji -
Number of replies: 0

Hi,

I want to download a course with its resources and use it offline. I am using a restful webservice. So far I am able to download the course schema using core_course_get_contents () And the content i get back is shown at the bottom.

But when I try to call the core_files_get_files service  I keep getting error with parameter issues.

Can someone please explain  what some of the following parameters mean or where I can get them. 

these three : contextid , component and contextlevel

From the documentation the core_get_files service requires the following parameters 

contextid | component  |filearea | itemid | filepath | filename | modified | contextlevel |instanceid 


The following JSON file is from the response of the core_course_get_contents () service . 

{

        "id": 4,

        "name": "PMP Test ",

        "visible": 1,

        "summary": "",

        "summaryformat": 1,

        "modules": [

            {

                "id": 10,

                "url": "ht t p: //m ysite. c om/moodle/ mod/resource/view.php?id=10",

                "name": "Lesson Objectives",

                "instance": 5,

                "visible": 1,

                "modicon": "h.t.tp:// mysite . c.o.m/moodle/theme/image.php /clean/core/1429612230/f/ png-24",

                "modname": "resource",

                "modplural": "Files",

                "indent": 0,

                "contents": [

                    {

                        "type": "file",

                        "filename": "Lift Objectives.png",

                        "filepath": "/",

                        "filesize": 31627,

                        "fileurl": "//mysite . com /moodle/webservice/pluginfile.php/41/mod_resource/content/3/Lift%20Objectives.png? forcedownload=1",

                        "timecreated": 1429683688,

                        "timemodified": 1429683708,

                        "sortorder": 1,

                        "userid": 3,

                        "author": "MR",

                        "license": "allrightsreserved"

                    }

                ]

            },

}

]

}

Thank you for the help smile

Average of ratings: -