canvas-lms

Canvas LMS REST API Quiz creation


I'm having an issue with quiz creation using the Canvas REST API:

I can create a new quiz with title set.

I can add N questions with the following parameters set:

When I look at my quizzes page, I can see the quiz exists, but it only shows that 1 question has been created for the quiz. I have to go to the quiz page, click the Edit button and then save the quiz for all of the questions to show up on the quizzes page.

What am I missing in this workflow?


Solution

  • So, for anyone interested in this question, the best solution I've been able to find is a hack. I tried doing comparisons of the quiz model data structure returned both before and after manually saving the quiz. There were some trivial differences, but only a couple meaningful ones. The only relevant difference was in the question_count attribute. It isn't being updated after adding questions.

    To "fix" this: after adding your questions, manually update the question_count attribute (via a PUSH).

    Perhaps this is a bug, perhaps I don't know what I'm doing. Either way, if anyone else has a better understanding of the Canvas REST API, please comment or provide a better answer.