How to get a history of all reports of a quiz

Jump to solution
Community Explorer


I have a quiz that allows students to write their answers on it.

Now, I want to get all those answers using the API.

I generate a report using the command below:

print ( "curso: "+str(" - quiz: "+str( )
        headers = {'Content-Type''application/json','Authorization''Bearer {}'.format(API_KEY)}
        url = API_URL+'/api/v1/courses/'+str('/quizzes/'+str('/reports?quiz_report[report_type]=student_analysis&quiz_report[includes_all_versions]=1'.format(,
        response =, headers=headers)
        r = json.loads(response.content.decode('utf-8'))
        url2 = r.get('url')
        print('URL Atualizado:', url2, sep = '\t')

This generates the report for me.

After that, I use the following URL to get the report

I get the following answer:  ( please click to see the JSON answer)

In the JSON answer, it got a parameter file, inside the file parameter, there is a URL parameter, I use this parameter to download to extract the CSV file and read the results from it.

But on the next day, I try to get CSV again, but I got an answer like this: ( please click to see the JSON answer)

There are other students reports that are generated that overwrite the most recent response?

Is it possible to get only the most recent report that contains the file['url'] parameter?


1 Solution
Community Explorer

I didn't add the parameter include[file] to the query, I think it was not supposed to store this value.

I take a different approach now and I was able to solve my problem now.

In the title, I write that I want all history of reports, but what I need its just the last report for a quiz with a specific title.

I need the CSV file from this last report, I need the URL where the CSV is stored.

I just make a request for this URL:[rep...

This URL generates the report for me, but it needs some seconds to create the report. So, I just wait for 10 seconds and send a new request to the same URL, this time I got the CSV URL. 

The job is done. I use the CSV to show a detailed report for that course on my custom web page.

View solution in original post