The Instructure Community will enter a read-only state on November 22, 2025 as we prepare to migrate to our new Community platform in early December.
Read our blog post for more info about this change.
Found this content helpful? Log in or sign up to leave a like!
So I'm trying to edit an assignment's submission_types using this documentation: Assignments - Canvas LMS REST API Documentation
I have it working for when you need to set it to one thing, i.e. "online_quiz" by using this syntax for the payload:
{'assignment[submission_types][]':"online_quiz"}
However, when I try to use multiple arguments as the API says is possible I can't get the call to work. Syntax:
{'assignment[submission_types][]':["online_text_entry", "online_url"]}
Comes back with a 400 error.
Any help would be appreciated.
I believe the syntax you are looking for would be like this if you're sending it as a JSON object:
{
"assignment": {
"submission_types": [
"online_text_entry",
"online_url"
]
}
}
The documentation says that assignment[submission_types][] is a string and you're trying pass it an array. That's why it's not working. Now let's see how to make it work.
It looks like you're trying to mix JSON encoding with the HTML form encoding. I recommend one or the other, but not both. When programming, I normally use JSON as it's easier to see the structures.
If you're using HTML form encoding (the application/x-www-form-urlencoded content type), then you specify the parameter multiple times
assignment[submission_types][]=online_text_entry&assignment[submission_types][]=online_url
If you are using JSON encoding (the application/json content type), then you make the submission_types property an array.
{ "assignment" : { "submission_types" : [ "online_text_entry", "online_url" ] } }
Oh, so funny story, I'm actually working on a V3 of your Course Due Dates google sheets app...
I believe it's supposed to be JSON encoded, but if that's so I'm not sure why the first syntax works?
Community helpTo interact with Panda Bot, our automated chatbot, you need to sign up or log in:
Sign inTo interact with Panda Bot, our automated chatbot, you need to sign up or log in:
Sign in