cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
cchrisman
Community Member

Enrollment API Questions

I am using Postman to test sending enrollments to Canvas API.  I was getting errors at first because I was using the SIS userid and SIS section id for the Post.  I got it working using the user_id and course_section_id within Canvas...that are not in my SIS.

My questions are:

1. Is there anyway to use the SIS ID's to enroll users so that I can do it directly from my SIS?

2. If not, how are others pulling the Canvas user_id and section id from the API before enrolling.

Thanks for your help.

0 Kudos
5 Replies
James
Community Champion

@cchrisman 

There are two ways to use SIS IDs as you describe.

  1. Use a SIS import where your SIS creates a CSV file and you import that into Canvas. This is probably the simplest approach. It is usually scheduled and doesn't provide near real-time results, so it may not be appropriate if you need immediate changes to Canvas. We use this approach at our institution and I run the process every 20 minutes with just the changes that have happened since the last successful run. This is also great for bulk population at the beginning of a term.
  2. Prefix your SIS IDs as described in API documentation. If a user has a SIS ID of jdoe524 and a Canvas user ID of 1234, can use sis_user_id:jdoe525 instead of 1234. In a path, it would look like /users/sis_user_id:jdoe525 instead of /users/1234.
cchrisman
Community Member

Thanks, James.  I reviewed the API documentation which matches your reply as well.  I now have it working with SIS IDs...thanks for your help.

cchrisman
Community Member

James,

Thanks again for your help.  As I mentioned, I have the SIS Section ID working for enrollments but now am having issues with the SIS User ID

For example, the form data documentation requires:  "enrollment[user_id] = Canvas ID" to enroll a user.

How do I modify the form data so it enrolls by sis.user.id?

I have tried about every combination I can think of but continue to get errors.

Thanks for your help.  It is appreciated.

James
Community Champion

@cchrisman 

Without testing to make sure, to enroll the user with SIS ID of jdoe525, you should use:

enrollment[user_id]=sis_user_id:jdoe525

When I first started using Canvas, there were some places where SIS IDs were not accepted so I cached the Canvas IDs locally and just refer to those. Since then, things have improved. I noticed that most places I encountered this is where it said id rather than user_id. The name of the property here is user_id, so it should work with the sis_user_id.

If you have tried the above and it doesn't work, then make sure that you can create an enrollment using a Canvas user ID. That will make sure that the rest of the form data is correct and that the real issue is just the SIS ID part and not something else with the request.

cchrisman
Community Member

Thanks, James.  That worked...your statement about making sure the Canvas ID was correct made me go back and make sure my SIS ID was an actual user.  It was not...I made sure the SIS ID was for the same test user and it worked.  Thanks again for all of your help.  It is greatly appreciated.