3

I have already check the mod/quiz/db/services.php , but not able to find any api for the same.

Note : Quiz data like questions, answers details.

Luv Gupta
  • 51
  • 1
  • 3

1 Answers1

5

Yes, if you are using moodle webservices, you can use mod_quiz_get_attempt_data for get questions data. You can use a lot of other functions by this link.

Bellow is an example of usage:

http://yourwebsite.com/moodle/webservice/rest/server.php?moodlewsrestformat=json&wstoken=YOUR_TOKEN&wsfunction=mod_quiz_get_attempt_data&attemptid=1&page=0

You have to replace attemptid, wstoken and page. I hope this helps

If you don't know how to enable webservices in moodle platform, you just need to go this link.

  • any tip for processing the response of `mod_quiz_get_attempt_data`? it seems all questions are returned inside html field on questions object. – Wesin Alves May 20 '21 at 00:23
  • Sorry for the late answer, its been a long while since I've messed with moodle, and back then this was one of my main concerns, to build my own layout. I don't think there's an easy way to do it as we speak. They really just return HTML, and I think it's kinda cool because imagine the headache it would be to reimplement all kinds of questions. But it is possible for you to try inject your own CSS within the response, I think it would be the way to go. – Anderson Freitas Dec 08 '21 at 13:58