Can you change notification preferences for all students using the API?

Jump to solution
EvanDonovan
Community Participant

Is there a way to change the notification preferences for all students from the default using the API?

We would like to reduce the notification frequencies without having to make all the students do it.

It doesn't seem like there is a way to do it via the interface as per this post, but I wanted to check if there is a way via the notification preferences API.

According to what I am seeing on l. 91 of the NotificationPreferencesController, which has this API code, it looks like you can only update for the current user:

return render_unauthorized_action unless @user == @current_user

 But am I misunderstanding that line of code?

 

 

Labels (1)
0 Likes
1 Solution
JamesSekcienski
Community Coach
Community Coach

Hello @EvanDonovan 

Based on that API call, you would need to use the query parameter to masquerade as each user when you are updating their notification preferences:  https://canvas.instructure.com/doc/api/file.masquerading.html

It looks like @bbennett2 shared a blog post on how he did this using Python: Update Student Notification Preferences with Python 

Thanks,
James Sekcienski

View solution in original post