AnsweredAssumed Answered

Student email list without so many API requests

Question asked by Kevin Meinholz on May 8, 2019
Latest reply on Aug 5, 2019 by Josue Carames

I'm currently using /api/v1/courses/:course_id/enrollments to generate a list of students in a set of classes. The list I'm generating needs to have SIS ID, student name, email, enrollment created at, enrollment updated at, last activity, and canvas state. I'm able to pull in everything I need, but email address. To get the email address, I'm using /api/v1/users/:user_id. But I'd like to try to minimize my API requests (if I have 50 students in class, I'm making 51 API requests and it isn't as fast as I'd like, and I'm doing this on about 40-50 classes per term). If I don't pull in the emails, I can generate a class roster in about 2-3 seconds, but if I include the email, it takes 9-10 seconds.


I've also tried /api/v1/courses/:course_id/users and this gets me everything I need for my list. However, I can't pull in all user states. I can't get users who have been deleted and I need that because some users are made inactive, while others are deleted, and I'd like to treat them the same way.


If I could include[]=email in the enrollments request or use enrollment_state[]=deleted in the users request, I'd have exactly what I need, but neither of these seem to be available.


Does anyone have any thoughts?