Creating Quiz Questions #648
-
I am having trouble creating or editing quiz questions. Regardless what I have tried, it generates a blank question. Attempts to edit the question throw error 500. Am I missing something? One thing I have tried: |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Have you inspected the response from the API? Is it giving an error or returning a properly formatted quiz? A 500 error is something on Instructure's servers and not necessarily related to the library. |
Beta Was this translation helpful? Give feedback.
-
Posting as a separate answer for clarity. The library combines keyword arguments for endpoints which accept different parameters. You should pass dict objects directly to the function either directly or as a variable, like this: question = {
"question_name": "Sample question",
"question_text": "This is the question text.",
"question_type": "numerical_question"
}
q.create_question(question=question) or q.create_question(question={
"question_name": "Sample question",
"question_text": "This is the question text.",
"question_type": "numerical_question"}
) This is documented, along with other examples, here: https://canvasapi.readthedocs.io/en/stable/keyword-args.html |
Beta Was this translation helpful? Give feedback.
Posting as a separate answer for clarity.
The library combines keyword arguments for endpoints which accept different parameters. You should pass dict objects directly to the function either directly or as a variable, like this:
or
This is documented, along with other examples, here: https://canvasapi.readthedocs.io/en/stable/keyword-args.html