cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
jdmendoza
Community Participant

Create Course with API

Jump to solution

When I'm creating the course through the API, I can't get the sis_course_id to persist and when I check the database sis_source_id is empty even though I'm passing the course[sis_course_id] on the data to post, it picks up everything else, so what am I missing?

Post body:

post-data.png

Post Result:

post-result.png

Thanks

1 Solution

Accepted Solutions
MattHanes
Community Champion

Before I attempt to help further, I would like to note that I am, most definitely, not a software engineer. I'm just a normal Canvas admin. But maybe someone else can chime in if I butcher this! :smileygrin:

"Manage SIS data" is an account level role and not a course level role. I believe you would need an administrator token to accomplish your task. I'm not 100% sure on this though.

If you are building a course creation tool for a teachers, you could leave out the part about sis_course_id and do that as a separate call using an administrator token. Maybe something like this:

  1. POST to create the course without sis_course_id using the teacher's role.
  2. Store the returned "id" field into a variable.
  3. PUT the sis_course_id into the course using an administrator token and the course id variable that was returned in Step 1.

I'm probably missing a much more elegant solution than this, but I'll let someone smarter than me weigh in on that.

View solution in original post

9 Replies
MattHanes
Community Champion

I just tried your exact setup in my test instance and it worked. The sis_course_id was not null in the return object. Just grasping at straws here, but is it possible you're missing the permission to "Manage SIS Data"?

jdmendoza
Community Participant

I'm trying to do it with the Teacher role, so that Teacher's can sync(create) their courses from the current SIS.

In order to create it with the sis_course_id the user would have to have the Administrator Role?

MattHanes
Community Champion

Before I attempt to help further, I would like to note that I am, most definitely, not a software engineer. I'm just a normal Canvas admin. But maybe someone else can chime in if I butcher this! :smileygrin:

"Manage SIS data" is an account level role and not a course level role. I believe you would need an administrator token to accomplish your task. I'm not 100% sure on this though.

If you are building a course creation tool for a teachers, you could leave out the part about sis_course_id and do that as a separate call using an administrator token. Maybe something like this:

  1. POST to create the course without sis_course_id using the teacher's role.
  2. Store the returned "id" field into a variable.
  3. PUT the sis_course_id into the course using an administrator token and the course id variable that was returned in Step 1.

I'm probably missing a much more elegant solution than this, but I'll let someone smarter than me weigh in on that.

View solution in original post

jdmendoza
Community Participant

That sounds like a viable solution. Do you know how to produce an admin token?

kona
Community Coach
Community Coach

 @jdmendoza , I know WAY less than (the awesome) Matt Hanes, but I do know that to get an admin token you need a Canvas admin to generate it for you. Do you know who the Canvas Admin is for your Canvas Environment? If so, then that's the person to talk with.

MattHanes
Community Champion

Here are the instructions for producing a token: How do I obtain an API access token for an account?

MattHanes
Community Champion

I should also note that the token generation process takes the role of the person who generated the token.

jdmendoza
Community Participant

Thanks a lot  @MattHanes ​ &  @kona !!!

kona
Community Coach
Community Coach

Which is why the Canvas Admin is needed. Smiley Happy