Error Posting to Enrollments - C#

Jump to solution
kfavara
Community Novice

I am using C# to post to the API. I have been successful creating users and courses, however, I cannot seem to get my users enrolled. 

I have created the user using the API and I can successfully GET the user using https://url.instructure.com/api/v1/users/sis_user_id:usernumber

I have created the course and I can successfully GET the course using https://url.instructure.com/api/v1/courses/sis_course_id:coursenumber

I am sending a POST statement to 

https://url.instructure.com/api/v1/courses/sis_course_id:coursenumber/enrollments

and sending the json data of 
{"enrollment":{"sis_user_id":"usernumber","type":"TeacherEnrollment"}}

 

I receive a 403 error. I have admin rights and can create users with my user and token. I have read elsewhere that the 403 error can also mean bad data, but my data appears to be correct. 

Thanks for your help.

Labels (1)
1 Solution
jperkins
Instructure
Instructure

It should work if you change your parameters to look like:

{"enrollment":{"user_id":"sis_user_id:usernumber","type":"TeacherEnrollment"}}‍‍

View solution in original post