-3

I'm trying to the all the questionnaire data from the report in Moodle at https://xxxxx/mod/questionnaire/report.php?instance=1266&action=dwnpg&group=0

This URL can download all the responses from Questionnaire submitted. How can I download this report via API then?

I'm trying to follow this article with no success https://support.openlms.net/hc/en-us/community/posts/9131457872541-Quickly-Extracting-Open-LMS-data-for-Spread-sheet-analysis

  • From my experience with other webpages, you can 'view source' and go to 'network' and look for API. It should be in JSON. – SChatcha Jul 25 '23 at 03:40

1 Answers1

0

Looks like the questionnaire activity is a contributed plugin, its not part of the core Moodle

https://docs.moodle.org/402/en/Questionnaire_module

In the source code, there isn't a web service for getting the data, only submitting it

db/services.php lists the webservices and their locations

https://github.com/PoetOS/moodle-mod_questionnaire/blob/MOODLE_400_STABLE/db/services.php

In this case, the services are in externallib.php

https://github.com/PoetOS/moodle-mod_questionnaire/blob/MOODLE_400_STABLE/externallib.php

Maybe add a comment for the developer here

https://moodle.org/plugins/view.php?plugin=mod_questionnaire

Otherwise, you will probably need to develop your own webservice

Some tips here

How create plugin for moodle for get user by option field with rest request

Note : the old way was to put the classes into externallib.php, the new way is to put the classes into this directory classes/external/

Russell England
  • 9,436
  • 1
  • 27
  • 41
  • Thank you so much for your answer. It's very helpful. But I cannot do much of the Dev here since I'm working on OpenLMS. I'm thinking may be I can get some data from SQL report via webservice instead. – jiradett kerdsri Jul 26 '23 at 04:14
  • I'm not familiar with OpenLMS, probably best to ask them if they have a webservice. If you can use SQL, then the use `install.xml` as a reference for the table and column names. https://github.com/PoetOS/moodle-mod_questionnaire/blob/MOODLE_400_STABLE/db/install.xml – Russell England Jul 26 '23 at 05:20
  • Thanks mate, I'm planning to use SQL to generate the report, and then get the data from that report by WebService API. – jiradett kerdsri Jul 28 '23 at 03:03