cancel
Showing results for 
Search instead for 
Did you mean: 
agschmid
Community Contributor

Quizzes: How to add file to file upload question using the API

I'm trying to figure out if it's possible to add a file to a file upload question in quizzes. 

I tested with assignments first (because it was a lot easier!) and the process requires many steps, with the last being that after the file was uploaded to the user's files, sending the file id in the assignment submission.

For quizzes, I've done the file upload and it's in the user's files, then I attempted to actually "take" the quiz through the api. I got as far as /api/v1/courses/:course_id/quizzes/:quiz_id/submissions/questions.

I have found all the other question types and what to add to the json body except for the file upload question:

Quiz Submission Questions - Canvas LMS REST API Documentation 

I was hoping I could just add the ID for the file as I did in assignments, but that doesn't work.

Has anyone been successful at adding a file (as the student) from the user's files to a quiz file upload question?

Tags (3)
0 Kudos
1 Reply
agschmid
Community Contributor

Update: There are actually a couple of issues with the quiz file upload process and I've filed a couple of tickets.

If you test assignments, the folder_id is returned for the user's files -> submissions folder. The assignments upload file is there. 

If you upload a file for quizzes, no folder_id is returned, (displays null), and while you can use the URL returned to view/download the file , it is not found in any of the user's folders. I would have expected it to be in the submissions folder also.

The next problem is that there is no documentation on the file_upload question type, so even if the file were uploaded correctly, it still could not be used if trying to take the quiz through the API.