Canvas API creating ModuleItem with type File - what to add for content? Folder?

Jump to solution
mgibson2
Community Explorer

Hi Im using canvas API trying to create a "File" module item (sometimes called "Dropbox") where student can both download some file to edit, and then upload up there edited file (the file is probably some quiz)

So I see that module item has. "File" type - I suspect thats what I want. Then the question is what to use for "content" - to then put in as "content_id". Folder seemed like the obvious choice. But when I created a folder and put the folders id in as the content id in my File module item I get the unfortunately not very informative (dreaded) error:

"The specified resource does not exist."
 
So Im guessing folder is not the right way to go for content. Quiz in fact works - however when I compare the file quiz with what is created via common cartridge they are different - and I need them to be the same - so I dont think thats what I want. thanks for help - mark

 

Labels (1)
0 Likes
1 Solution
cstrikwerda
Instructure
Instructure

Hello @mgibson2 thanks for posting in the community. 

I understand that we are updating information in Modules via the API and I want to help clarify.

It sounds like your second post is more close to what you want, and it sounds like you were creating a file upload question within a quiz via API. This is what that API call looks like: https://canvas.instructure.com/doc/api/quiz_questions.html#method.quizzes/quiz_questions.create

However, I would advise to use the Assignment Item type instead of Quizzes. Manipulating the Assignment API would be much easier than trying to create each individual quiz question via API. https://canvas.instructure.com/doc/api/assignments.html#method.assignments_api.create

If you are creating an Assignment via Modules, we would refer to the create module item API:
https://canvas.instructure.com/doc/api/modules.html#method.context_module_items_api.create

That would be the API for creating an Assignment, which is the basic item for allowing students to upload their Files into a dropbox for you to grade. What are Assignments? (guide)

You would want to specify that Assignment to be online_upload if you are wanting to have your students be able to upload files into that Assignment.

Hope this helps!

View solution in original post

0 Likes