Add New User using API on Canvas Free for Teachers

btnguyen
Community Member

Hello,

I'm looking to automate inviting users to a Canvas page on Canvas Free for Teachers based on their email address.

I looked at the https://canvas.instructure.com/doc/api/enrollments.html#method.enrollments_api.create API and saw that it takes in a user_id. How would I go about getting or looking for student's user_id based on their email address.

I would think the workflow is similar to us adding students using the web UI?

API call #1: Check if email is tied to a user account 

Case 1: User has a Canvas account:

  1. API call #2 to look up user_id by email address
  2. API call #3 to send invite using that ID

Case 2: User does not have a Canvas account

  1. API call #2 to create an account and get ID
  2. API call #3 to enroll using that ID

Please let me know what I can do. Thank you!

 

0 Likes