Accessing detailed quiz timestamp data with web services API

Accessing detailed quiz timestamp data with web services API

by Antti Karttunen -
Number of replies: 2

Hi All,


We are developing a Moodle web service client that would read detailed timestamp data for quiz responses and use the data for learning analytics. We are running Moodle 3.5.


We have successfully used web services API function mod_quiz_get_attempt_review to get data on a quiz attempt. 


Our initial plan was to take the response from mod_quiz_get_attempt_review and read the field “lastactiontime” in the “questions” array to see when the final response for each individual question was submitted. This works nicely when the quiz attempt has not yet been finished. However, when the quiz attempt is finished, “lastactiontime” becomes identical for all questions (“attempt finished” timestamp).


We have investigated the mod_quiz web service API and we could not figure out a way to read the detailed timestamp data for each question. I wonder if there is some way to access the timestamps of each “step” via web services API? In the normal web UI, the information is nicely available via the “Review attempt” functionality. 


And if we are approaching this in a completely wrong way, we would greatly appreciate all advice!


Best wishes,

Antti Karttunen

Aalto University


Average of ratings: -
In reply to Antti Karttunen

Re: Accessing detailed quiz timestamp data with web services API

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

https://docs.moodle.org/dev/Overview_of_the_Moodle_question_engine#Detailed_data_about_an_attempt shows the data you want for detailed analytics. I doubt any web service gives you that level of details. Either make your own web service (e.g. a local plugin), or have your analytics access the database in some other way.

In reply to Tim Hunt

Re: Accessing detailed quiz timestamp data with web services API

by Antti Karttunen -

Thanks a lot for the information Tim! 

We will next investigate how to implement a local plugin for our purposes. 


Best wishes,

Antti