Canvas API call not returning email of students

Jump to solution
sywang
Community Explorer

Hi all, 

I'm integrating Canvas into another system and I'm having trouble with the API calls. Currently, I'm using "url:GET|/api/v1/courses/:course_id/users" to get all the users within a course. However, when I check the user objects returned, email is always "undef". The returned users look like this:

$VAR1 = {

          'sis_user_id' => undef,

          'id' => 4,

          'short_name' => 'Judith Diaz',

          'name' => 'Judith Diaz',

          'sortable_name' => 'Diaz, Judith',

          'team_name' => 'Test group 1',

          'email' => undef,

          'sis_import_id' => undef,

          'created_at' => '2022-04-15T10:09:28-06:00',

          'integration_id' => undef

        };

$VAR2 = {

          'sis_user_id' => undef,

          'id' => 6,

          'short_name' => 'Synder Leigh',

          'name' => 'Synder Leigh',

          'sortable_name' => 'Leigh, Synder',

          'team_name' => 'Test group 1',

          'email' => undef,

          'sis_import_id' => undef,

          'created_at' => '2022-04-15T12:00:41-06:00',

          'integration_id' => undef

        };

$VAR3 = {

          'sis_user_id' => undef,

          'id' => 5,

          'short_name' => 'Victoria Price',

          'name' => 'Victoria Price',

          'sortable_name' => 'Price, Victoria',

          'team_name' => 'Test group 1',

          'email' => undef,

          'sis_import_id' => undef,

          'created_at' => '2022-04-15T10:09:28-06:00',

          'integration_id' => undef

        };

(The'sis_user_id', 'sis_import_id', and 'integration_id' are supposed to be undef because I didn't set them when I manually added these three users to the Canvas course.)

When I check the user details in Canvas, the student's email address is present but it's not being returned in the API call. Does anyone know why and how to fix this? For reference, I'm using a Canvas instance built with the instructions from Quick Start on the Canvas GitHub wiki page and it is hosted on AWS. Also, the three test users are added manually using fake email addresses. 

Thanks in advance!!

0 Likes
1 Solution
greydon
Instructure
Instructure

Hello @sywang 

Thank you for contacting Canvas Support. We're sorry to hear you've been experiencing issues with running API for users. You are using the correct API format to generate information and the email should be included as long as the email on file with the students has been set up correctly. It doesn't sound like you are using a SIS but creating these users manually. We understand you are using fake email addresses, have you tried running this for an email on file that is valid? 

Here is the Canvas guide:

https://canvas.instructure.com/doc/api/users.html

Because of the complexity of the issue, and the concerns for privacy, it would be best if you contacted Canvas Support directly to pinpoint the source of the issue and provide a resolution:

https://community.canvaslms.com/t5/Canvas-Basics-Guide/How-do-I-contact-Canvas-Support/ta-p/389767 

View solution in original post

0 Likes