Showing results for 
Search instead for 
Did you mean: 

Question banks - What can be done without an API?

Community Champion
3 2 493

A couple of days ago I decided to re-examine an issue that has annoyed me several times, the lack of a Question Bank API. The process began with some postings to followup the question raised by 10618071 in

This lead to some Tampermoney scripts (such as that enabled me to add question banks. This success lead to a desire for further automation and this lead me to investigate the combination of Puppeteer ( and Node to run Javascripts to create a question bank- the first result was Using Puppeteer to insert new question bank: Chip sandbox. After seeing what Puppeteer could do I expanded upon the program to have a program that would not only let me add question banks but would also output a JSON file of the resulting set of question banks (which of course could then be used with the Canvas API to insert questions into question banks!). The resulting program is documented at

Some obvious programs that could be derived from this last script would be:

  • to read a JSON file or CSV file that contains a list of question banks that one wants to create along with the course_id to create them in
  • a program to simply output the JSON for the existing question banks in a course

Of course, the real solution is to add a Question bank API. Meanwhile, quite a lot can be done despite the lack of such an API.

Once again I wish to thank  @James  and the many others who have provided examples of JavaScript and Puppeteer scripts. I still do not know how to use Puppeteer (well) and lack confidence in navigating DOM structures (especially of pages that have elements that lack IDs or that dynamically modify the Javascript on a page).

Community Champion

For those who find Puppeteer useful, I found that it is possible to have one script that logins into Canvas, saves the cookies, and quits (closing the browser window). Then another script can be run that loads these cookies and then interactions with Canvas without having to log in again. Details at .

Community Champion

For more fun with Puppeteer see my comment at

This latest Puppeteer code uses Promises (to deal with parts of the page that appear dynamically) and two supporting programs that walk two tree-structured sets of dynamically loaded Javascript supplied data, so that when the main program runs - it knows how to go directly to the correct place in the tree.