Community

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
mgibson2
New Member

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

Jump to solution

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 Kudos
1 Solution

Accepted Solutions
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 Kudos
2 Replies
mgibson2
New Member

I should be more clear about the quiz that worked - what works is if i create a module item of type "Quiz" (not File) and then link in a quiz that has a question of type "file_upload_question". And that all works - and seems to more or less be a dropbox - however that dropbox looks different than the dropbox from common cartridge - so Im guessing theres another way to go about this? I thought it might be the File type - but cant get that to work - the api docs lack documentation on how one pieces this stuff together - or if theres such docs would love to hear about that - thanks for help - mark

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!

0 Kudos