Showing results for 
Search instead for 
Did you mean: 

Create a Sandbox Course via Web Application/API?

Jump to solution

Hi Canvas gurus,

I've got a bit of a dreamscape project that I'm looking to build and am wondering if anyone has done anything similar or is able to help me think through how to best develop it. What I'm wanting to build is a webpage on our university's site that would allow a faculty member to create a sandbox course on their own as opposed to emailing our team to do it for them. 

The simplest way to achieve this would be to enable faculty to create courses within Canvas, however, I'd like to make a more controlled process that automatically adds the course to the correct subaccount, and also has a prefix appended to the reference ID.

So here's the ideal solution: a webpage where a faculty member signs in, they click a "Create Sandbox Course" button that asks what they'd like the name of the course to be, and then that course gets created and with them enrolled as the instructor. Any ideas of how to achieve this or is this too simplistic in the reality of what needs to happen?

I appreciate any and all recommendations.

- Michael

54 Replies

Thanks so much  @sanders3 ‌! Now for a super n00b question, what's the easiest way to deploy this? I can see from exploring a few of the files that there are some modifications that should be done in order to point to our Canvas environment, use our dev key, etc., but in terms of actually getting it I can reach out to the devs too. Thanks again!

 @michael_mcgarry ‌, that's definitely going to be a question for the developers of the tool (you call yourself a super n00b, so if there is a level that is more n00b than that, that would be me). I'm also going to share this entire discussion with the‌ group to get the eyes of the experts on it.

Sounds great. Thanks again for all your help  @sanders3 ‌ Smiley Happy

Hi  @mmcgary ,

I wanted to check in and see how you got along with this? I had a bit of a look and you would need a server (such as in AWS or Azure) to deploy the LTI tool to.

The readme contains some very basic info on how to get up and running, but doesn't cover off the basics of getting a server and environment set up. I would suggest, given that this will use developer keys for your instance (and hence have complete unfettered access) you would want to ensure you have a server set up, well configured, security hardened and so on. So these are some things to keep in mind, in that it is not a simple click to turn on.

There may be some Canvas partners that would be willing to assist you with this, you can check out Instructure | Instructure Partners for a list.

Please let me know how you get on, would be curious to hear how you progressed.

Hope that helps!


I'd like to point out that while the LTI solution above requires server configuration etc, the JavaScript option I posted above can be implemented using Canvas Themes and a few prerequisite steps.

Hi carroll-ccsd,

What are the prerequisites one would need to get this to work with just the java upload? I'm much more interested in that sort of plug-and-play method than the full server-run version. I admittedly got stumped through all that config info and abandoned this for a while. 

Thanks so much for your contributions to this!

- Michael

Hi Michael,

I'd be happy to help you get setup.

Check out the README for more details ccsd-canvas/workrooms at master · robert-carroll/ccsd-canvas · GitHub 

Specifically, skipping over the Implementation & Deployment section, which is part of our SIS Import and is there as a more complete solution.

And get right to Configuration

cfg: {
     // the ID of the subaccount where all workrooms should be put
     wkrm_acct_id: 123456,
     // the ID of the term that all workrooms should be created with (Forever)
     term_id: 1234,
     // the roles allowed to create a workroom
     roles: ['teacher']

The wkrm_acct_id is the account id of a sub account within your instance, this basically makes a 'folder' for all your user created workrooms to go into, so they don't clutter your other spaces. Create the sub account in the root of your instance, or anywhere you like... this is what our Root Sub Accounts look like.

Workrooms is in our root, but at the bottom alphabetically.

The term_id of the Forever Term, I believe each instance has one, you'll just have to identify what yours is. The Live API can help here: > Enrollment Terms > List Enrollment Terms

I've created a Github Gist for you, which has all the utility functions and the workroom code setup inline for you. All you'd have to do is set those 2 values and append it to your current theme-able JavaScript file. gist example for canvas workrooms · GitHub 

Once that works for you on your test instance, I'd recommend compressing the file down for production with something like or

From the README, the Additional Considerations and workroom.enroll() options can be addressed later.

View solution in original post

Thanks. I must be setting something up wrong. I've modified those two lines in the configuration section to point to an appropriate sub-account and term, but I'm not seeing a Workroom button anywhere. It's supposed to appear on the /courses page, correct?

Ahh yes, the issue of copy pasting without actually executing the example I've provided. :smileygrin:

Lines 18 and 34 need a semicolon after the }

I've updated the gist.

Thank you so much carroll-ccsd! I've been tweaking bits of it now that I've gotten it working so that the resulting course names are to my liking Smiley Happy Now I have another it possible that me doing this over and over could cause the server to get angry and throw an error? I had it all working and now I'm consistently getting the "There was an error creating the workroom." message, which wasn't happening before.

The console is saying that it's getting a bad request:

" POST 400 (Bad Request) "


Looks like it works if I'm logged in or masquerading as someone else with admin permissions as well as being a teacher, but from several other instructor accounts I get the same error dialogue but with a 401 (unauthorized) message in the console:

"Failed to load resource: the server responded with a status of 401 (Unauthorized)"

Could this be a confilict of permissions within our Canvas instance? Specifically what I'm thinking is we don't allow instructors to create courses. I was hoping this would hop over that permission. Just thinking out loud. Thanks again for all your help on this.