AnsweredAssumed Answered

Create a course using the API

Question asked by Daniel Olivas on Nov 15, 2018
Latest reply on Nov 29, 2018 by Daniel Olivas

I'm borrowing code from Canvas API Calls using Google Apps Script 


I'm not sure how to pass the course parameters.  I've tried multiple ways.


apiCall = canvasAPI("POST /api/v1/accounts/1/courses?course\[name\]=The Best Course Ever");


and also like this:


function myFunction() {
   var j = {
         "name": "Another Test Course",
         "account_id": 201,
         "workflow_state": "unpublished"

    var myJSON = JSON.stringify(j);
    var apiCall = canvasAPI("POST /api/v1/accounts/201/courses",myJSON);


When I run both of these, the response looks like all the courses i'm enrolled in, but the no course gets created.


Does anyone have sample code, using Google Script, that creates a new course?  Or any sample code that uses the API to create a new course?