cancel
Showing results for 
Search instead for 
Did you mean: 
michael_mcgarr1
Surveyor

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.


Thanks!
- Michael

54 Replies

So strange...if I have any other role on line 57, other 'teacher' the button doesn't appear when I'm logged in. Still just like this:

278835_Screen Shot 2018-06-07 at 8.59.23 AM.png

But if I masquerade as an instructor, it works perfectly; which is the end goal anyway so this is far from a deal-breaker since as an admin I can create courses whenever I want anyway. Just a weird situation. At any rate though, I think we have a working solution that we can deploy and make both our faculty happy, and also my team so we don't have to manually create these any more :smileygrin:

Actually I think you may have found a bug... brb.

EDIT: Yep!

Change line 235 of your file.

// if (ccsd.util.hasAnyRole(workroom.cfg.roles.join(','))) {
if (ccsd.util.hasAnyRole.apply(this, workroom.cfg.roles)) {‍‍‍

I've updated the repo source and the gist referenced in this thread.

Nicely done! That brought it back. Just hitting that weird error where it throws the "There was an error creating the workroom" and the status 400 bad request again.

278836_Screen Shot 2018-06-07 at 12.45.47 PM.png

But that does appear to only be from my admin side of things, which again, I'm not terribly concerned with so long as it works for faculty.

EDIT: Here's the full error in the console:

error status 400

OK... When I compared your file against the Gist I noticed you also did this at line 103...

name: short_name,
course_code: long_name,

vs:

name: long_name,
course_code: short_name,

When I maxed out the Enter Course Name:* field length, I also got a 400 Bad Request. I think you swapped out those short and long name fields, and you're hitting character limits. Which makes more sense than a permissions error.

I actually typed a bunch of long nonsense into the UI for these two values and it was ok...

EDIT:

If you click on the network tab for that 400 and then Preview, I found this...

  1. {errors: {,…}}
    1. errors{,…}
      1. sis_source_id[{attribute: "sis_source_id", type: "SIS ID "SB-JUN07_18-ROBERT CARROLL" is already in use",…}]
        1. 0{attribute: "sis_source_id", type: "SIS ID "SB-JUN07_18-ROBERT CARROLL" is already in use",…}
          1. attribute"sis_source_id"
          2. message"SIS ID "SB-JUN07_18-ROBERT CARROLL" is already in use"
          3. type"SIS ID "SB-JUN07_18-ROBERT CARROLL" is already in use"

Looks like you might want to revert some of your date and name settings back to the defaults. We use the date/time to allow teachers to create multiple workrooms in 1 day. They won't get carried away. Or... you can add error handling.

carroll-ccsd. You. Are. The. MAN! That did it. The SIS ID having a cloned identity was the issue. Now everything works exactly as envisioned. Are you going to be at Instructurecon this year? If so, find me, because I definitely owe you a beer or something out of this. Thanks a TON!

That's Fantastic! 

You're welcome  @michael_mcgarry , I'm glad you have working solution.

I will be at InstructureCon, including hack night, game night, and any session involving food or data.

See you there! :smileycool:

Yep, we had to turn on "Teachers" can make courses, then we hide the button to create courses. We have another process that gives every employee a single workroom after it adds them as a user to Canvas, and makes them a teacher in the workroom. So that ends up giving them creation rights but a specific creation button. Perhaps Robert explained that further down, I just kind of jumped into the middle. Smiley Happy

dwahl_sales
Instructure
Instructure

Hi  @michael_mcgarry ‌,

You might consider taking a look at the code for Demo Arigato which is a separate webapp that provisions courses into a canvas instance and seeing if it will point you in the direction you're looking to go.

kim_vincent-lay
Surveyor

 @michael_mcgarry ‌ I just saw this and looks like you got lots of ideas here 🙂  If you want to chat with our programmer who wrote a quick script for requesting 'sandboxes' I am sure he'd share.  Faculty just login with their regular credentials and literally just click a button that requests a sandbox and it creates it immediately in Canvas.

:- Kim