Download link not always provided when requesting student analysis report

Jump to solution
ThomasDomas
Community Explorer

Hi, I work in analytics for my institution.

I currently have a script that downloads all student analysis reports through the Canvas API, but it throws an exception about every 5GB of data because a download url isn't always provided when requested. It should also be noted that this error isn't consistent. The same request that doesn't provide a download url in one instance may provide a download url in another instance. My script works as followed:

Step 1:

I make a post request to begin generation of a student analysis report

POST /api/v1/courses/:course_id/quizzes/:quiz_id/reports?quiz_report[report_type]=student_analysis

The post request returns a progress url where I can check on the generation progress of the file

Step 2:

I make a get request with the progress url every half second to see if completion is 100%

POST /api/v1/progress/some_id

Step 3:

After completion is 100%, I repeat step 1 except I use a get request instead of a post request.

Get /api/v1/courses/:course_id/quizzes/:quiz_id/reports?quiz_report[report_type]=student_analysis

From this get request, I can access the json and get the download url by accessing the dictionary in the "file" value and then accessing the "url" value inside that dictionary.

However, once in a great while there is no "file" key. This results in my program trying to access a null value, which throws an exception. If anyone has any guidance on why this occurs sometimes, I would be very grateful. Have a great day!

Labels (1)
0 Likes
1 Solution
ColtonSwapp
Instructure Alumni
Instructure Alumni

Hello @ThomasDomas 

I understand that you are running into issues when trying to download the student analysis report, after running your script. 

Since the behavior seems to be inconsistent, It might be best to have Canvas support look into this further to see if this is related to a known issue. 

Can we have you submit a ticket to Canvas support on this issue?

Thanks! 

View solution in original post