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!
I am try to use the New Quizzes API to modify an existing quiz. For example, to remove the restrict student result view I use the following call with cURL:
curl https://domain.edu:443/api/quiz/v1/courses/51989/quizzes/1765410 -X PATCH -H "Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" -d "quiz[quiz_settings][result_view_settings][result_view_restricted]=false"
If nobody has taken the quiz yet, the call parses correctly and the restrictions are removed. However, the call also results in the quiz being unpublished. If I try on a quiz which has already been answered no changes are made with the error:
{"errors":[{"workflow_state":"Can't unpublish if there are student submissions"}]}
I can't understand why this call is causing the quiz to attempt to unpublish. Is this a bug or am I missing something? Thanks in advance if anyone has any ideas.
Solved! Go to Solution.
Good catch on the results_view_settings. I didn't notice that because I was focusing on the unpublish problem. Yeah, that is problematic. It still unpublishes, even with the correct name.
Others probably know better than I do about how to report stuff. I don't have a direct line to any developers (although I never did, the person who always told me to contact him if there were problems with the API has left Instructure). I always use the Help > Report a Problem link from within Canvas. Then it goes to level 1 support who thinks I'm an idiot and eventually I'm persistent enough to get it to level 2 support where they actually look at what I wrote.
Going through your CSM is another good way.
The Live API is built off the documentation, so fixing it in the documentation should fix it in the Live API.
Generally, I avoid using New Quizzes as much as possible. The only time I really look into them is when someone else has a question about it.
That sure sounds like a bug. The PATCH is supposed to handle partial updates of fields and if you don't specify the published state, it shouldn't touch it. Unfortunately, they haven't released the source code for New Quizzes for us to go through and try to see what's going on.
One thing I like to do when something is acting wonky is to look at the call that Canvas makes. I open up the developer tools in the browser and check the Fetch/XHR traffic.
When you update the Restrict Student View Result, it makes a PATCH call to <instance>.quiz-lti-iad-prod.instructure.com/api/assignments/:assignment_id?scope=quiz.build. Note that :assignment_id here is not the same assignment_id within Canvas. It's not using the Canvas API, it's using the New Quizzes instance directly. The payload is {result_view_restricted:false}, which means that the only thing it's sending is the one setting.
That all looks good and the New Quiz was still published after I made the change. No students had taken it, but it looks like we're focusing on the unpublishing of the assignment.
I had suspected that Canvas would send all of the settings like they sometimes do with other API calls, but that was not the case.
Now we know that New Quizzes through the web interface works properly, but it's something within the API causing the problem.
This is my first look into the New Quizzes API and I must say that it is confusing. It says /quizzes/:assignment_id rather than /quizzes/:quiz_id, which is the normal way things are done. But I missed the quiz in /api/quiz/v1 at first, too. Once I caught that, I was able to access it.
I sent the command to restrict the view and it unpublished the assignment. That confirms that someone else is able to see what you're seeing.
Setting it to true did not re-publish the assignment. It's not a case of the code inadvertently copying the value to other settings.
Since the option to publish or unpublish the quiz is not available in that API call, it should not be unpublishing the assignment.
Perhaps there is something about changing whether to not restrict students viewing the results should make the assignment unpublished. That makes no sense and it works within the web interface, so we can rule that out.
The next question is whether it's specific to the review_view_settings or it is broader. I tried to change the points_possible and it also changed the assignment to unpublished.
Without trying every single setting. It seems that any update to the settings through the Update a Single Quiz endpoint results in the quiz being unpublished. This does not match the behavior in the web interface.
I've gone through all the scenarios I can think of to try to see if it makes sense at all. It doesn't! I'd call it a bug and file report it.
A messy workaround for the time being: get the assignment to see what the published state is, update the quiz settings, then change the re-publish the assignment if it was originally published.
Edit: However, that's not going to help with the quizzes with student submissions. For those, you may have to do it through the web or make the call to the quiz-lti-iad-prod.instructure.com.
The typical workflow is to do all the quiz development ahead of time and then publish it when done. That may be why the bug hasn't manifested itself yet. But still, what we're seeing should not be happening.
James, thank you for your detailed reply! Thank you also for confirming that you are seeing the same thing that I am. I didn't think of using the developer tools within the browser to monitor traffic. I am an instructor who uses the API a lot to automate the modification quizzes and have been waiting for the New Quizzes API to be released before I transition away from classic quizzes. It looks like the New Quizzes API is still a work in progress like New Quizzes itself. Would you be able to tell me where I would report this bug online? In the past I have contacted the customer manager through our DE Department. I do agree that the New Quizzes API is confusing because they don't follow the format used previously. I have also noticed that there is a typo in the LIve API page and in the API documentation. It says to change the results view settings you should use [results_view_settings], however it should actually be [result_view_settings]. I reported this to them a while back and they still haven't fixed it. Thanks again for taking the time to look into this. It is greatly appreciated. Simon.
Good catch on the results_view_settings. I didn't notice that because I was focusing on the unpublish problem. Yeah, that is problematic. It still unpublishes, even with the correct name.
Others probably know better than I do about how to report stuff. I don't have a direct line to any developers (although I never did, the person who always told me to contact him if there were problems with the API has left Instructure). I always use the Help > Report a Problem link from within Canvas. Then it goes to level 1 support who thinks I'm an idiot and eventually I'm persistent enough to get it to level 2 support where they actually look at what I wrote.
Going through your CSM is another good way.
The Live API is built off the documentation, so fixing it in the documentation should fix it in the Live API.
Generally, I avoid using New Quizzes as much as possible. The only time I really look into them is when someone else has a question about it.
Thanks James! I will contact our campus CSM. Simon
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