Canvas API call to update an existing quiz question fails with error 500

MargarethaMauer
Community Member

Calling  url:PUT|/api/v1/courses/:course_id/quizzes/:quiz_id/questions/:id to update a quiz question answer.


When updating an existing quiz question answer using Python request library, the following error results

<Response [500]>
b'{"errors":[{"message":"An error occurred.","error_code":"internal_server_error"}],"error_report_id":4595}'

 When the answer portion is removed, the request works. 

In the documentation, there is no layout available for the answer list.  https://canvas.instructure.com/doc/api/quiz_questions.htm


Could someone provide a working example to update and existing quiz question with the answers included?

Example of API payload that produce the error:

question[position]=2&question[points_possible]=1.0&question[question_type]=multiple_choice_question&... referring to transactions and atomicity, consistency, isolation, and durability (ACID) compliance in relational databases, which statement describes transaction isolation?&question[answers]=[{'weight': 0.0, 'id': 58609.0, 'text': 'All data changes that are made to the database must be permanent as soon as a transaction is successfully completed.'}, {'weight': 0.0, 'id': 40605.0, 'text': 'All data that is written to the database as part of the transaction must adhere to all defined rules.'}, {'weight': 0.0, 'id': 9522.0, 'text': 'Each transaction either succeeds as a whole or is invalidated if any part of the transaction fails.'}, {'weight': 100.0, 'id': 25381.0, 'text': 'Each transaction is independent unto itself to ensure data concurrency and control.'}]

Example of API payload that is successful:

question[position]=2&question[points_possible]=1.0&question[question_type]=multiple_choice_question&question[question_text]=When referring to transactions and atomicity, consistency, isolation, and durability (ACID) compliance in relational databases, which statement describes transaction isolation?

 

Labels (2)
0 Likes