AnsweredAssumed Answered

API: Inconsistency for enrollment type returned - a bug?

Question asked by Andrea G Schmidt on Jun 28, 2019
Latest reply on Jun 28, 2019 by Peter Love

There are a few different ways to get enrollment information for a user and it seems how "type" is returned is not consistent. Not sure if this should be reported as a bug or if we just need to live with the inconsistencies. It complicates things if the type in code for an LTI tool, for example, and in one place you receive "StudentEnrollment" for the type, but in another you receive "student".

 

Examples (I removed everything between type and roles from the return):

https://canvas.beta.instructure.com/doc/api/courses.html
GET /api/v1/users/:user_id/courses
Course1:
   "type": "student",
   "role": "Instructor-Added Student",
Course2:
   "type": "student",
   "role": "StudentEnrollment",

 

https://canvas.beta.instructure.com/doc/api/enrollments.html
GET /api/v1/courses/:course_id/enrollments
Course1:
   "type": "StudentEnrollment",
   "role": "Instructor-Added Student",
Course2:
   "type": "StudentEnrollment",
   "role": "StudentEnrollment",

GET /api/v1/users/:user_id/enrollments
Course1:
   "type": "StudentEnrollment",
   "role": "Instructor-Added Student",
Course2:
   "type": "StudentEnrollment",
   "role": "StudentEnrollment",

Outcomes