We are trying to get our users to create courses using a Google Form. We link to this form in Canvas.
I can successfully create a course using the API with POST /api/v1/accounts/self/courses
Prior to calling this I do a GET /api/v1/accounts/1/users to get some information on the user submitting the form.
So I have two questions.
1.) Is there a way to get the SIS_USER_ID for a specific user using the API?
2.) How can I get the course_id of a course that was just created?
I need both the course_id and the user_id to enroll the user in the course using enrollments API.
Thanks,
Solved! Go to Solution.
Greetings @daniel_olivas ,
1. Since you are using the permissions of the person filling out the form, the GET call on users/self will not return an SIS ID because teachers do not typically have SIS permission rights by default in Canvas. However, you do not need the sis_user_id to enroll that person because the response object includes their Canvas user ID which is what the enrollment[user_id] is supposed to be anyway. Does that make sense?
If you really need the sis_user_id for some other reason, you will have to perform the GET call to get their Canvas User ID and then use an Admin token to GET that user which returns the sis_user_id
2. When you create the course via the API, you get a response object back that contains the course_id. It's just called "id" in that return object.
Greetings @daniel_olivas ,
1. Since you are using the permissions of the person filling out the form, the GET call on users/self will not return an SIS ID because teachers do not typically have SIS permission rights by default in Canvas. However, you do not need the sis_user_id to enroll that person because the response object includes their Canvas user ID which is what the enrollment[user_id] is supposed to be anyway. Does that make sense?
If you really need the sis_user_id for some other reason, you will have to perform the GET call to get their Canvas User ID and then use an Admin token to GET that user which returns the sis_user_id
2. When you create the course via the API, you get a response object back that contains the course_id. It's just called "id" in that return object.
Ok, I think I figured this one out.
FYI,Postman is a great tool to test APIs and see responses.