new quizzes #628
Replies: 2 comments 5 replies
-
Did you have to do anything special to get this working? I cant for the life of me get the get_new_quiz call to work! I always get the 'Course' object has no attribute 'get_new_quiz' |
Beta Was this translation helpful? Give feedback.
-
I suspect this is misbehaving due to how CanvasAPI handles lists in complex arguments. Ultimately, we take the keyword arguments that are passed into the function and convert them into form-data. I spent a little bit of time in Postman trying different formats and can't seem to find a version it likes. Either it returns a 500, 502, or when it does 200 the values are unchanged. If someone can figure out the valid version in form-data to send, that'd be very helpful. We could also look into sending the request as JSON instead of form-data. |
Beta Was this translation helpful? Give feedback.
-
I was quite intrigued by the release of REST endpoints for new quizzes in Canvas, and was especially interested to see that the latest version of canvasapi was incorporating this functionality. I have been testing out the methods and arguments for a new quiz object, and have encountered a complication that my meager brain cannot seem to overcome.
So far, many of the settings work as expected. I am able to readily get a new quiz object with:
Then, I am able to modify the new quiz settings by passing such arguments as:
using the "update" method:
However, I am experiencing some difficulties with the IP filter settings for the new quiz. I can enable or disable the IP filter setting well enough with this:
But I cannot for the life of me figure out how to post the list of IP address ranges. Based on my understanding of the Canvas documentation, it seems it is supposed to be in the form of a list of lists:
When I attempt to post this using the "update" method for the new quiz, I receive a "status code 502" error.
If I manually apply the IP filter to the new quiz using the Web interface and then view the "quiz_settings" property of the new quiz object, the format of the IP range seems to coincide with that described above:
I have attempted all sorts of variations for the format of the IP address range, but to no avail. I am wondering if there is something simple I am overlooking. Any insight or advice would be greatly appreciated.
Beta Was this translation helpful? Give feedback.
All reactions