Celebrate Excellence in Education: Nominate Outstanding Educators by April 15!
Found this content helpful? Log in or sign up to leave a like!
The Canvas API is fairly complete but I can't find anything on the Question Bank. I am creating a module interface organized by outcomes, and quiz outcomes are stored on the question bank. Any idea how to get which outcomes are tied to a question bank?
I have also discovered that there is no API to list the question groups in a quiz. I hopefully someone can prove me wrong!
After being annoyed that there is no question bank API, I thought about using requests to the Canvas UI using Tampermoney. It turns out that this is complicated because although in the end, it is just POST of a title (i.e., the name of a question bank) via a form. Unfortunately, this form uses an authenticity token to prevent cross site request forgery (CSRF). So the solution was to find the form on a page (when logged into the course where you want to create the question banks), fill-in the name of the question bank and send the form. The results (and script) are shown at https://kth.instructure.com/courses/11/pages/using-tampermonkey-to-add-question-banks
It would have been much nicer to have had an API such as:
POST /api/v1/courses/:course_id/question_banks
with a JSON payload of the form:
payload={'assessment_question_bank[title]': title}
I would like to thanks @James for his script access-report-instructor.user.js (from https://github.com/jamesjonesmath/canvancement ) as an inspiration. It helped get me started with the script I wrote (which is not very elegant, but shows that is is possible to create question banks without having to manually click at the GUI).
2019-07-16: An improved version that adds a button to invoke the additional functionality is described at https://kth.instructure.com/courses/11/pages/using-tampermonkey-to-add-question-banks-v2 .
Additionally, I have added a Puppeteer script to be able to get the list of Question banks with the id and number. This can be found at https://kth.instructure.com/courses/11/pages/using-puppeteer-to-access-list-of-banks
Unfortunately, this script has to do a login to get into the Canvas instance before it can navigate to the Question Bank page and collect the desired data.
Further augmented with a program to do insertion of questin banks via Puppeteer, see https://kth.instructure.com/courses/11/pages/using-puppeteer-to-insert-new-question-bank
To participate in the Instructure Community, you need to sign up or log in:
Sign In