@lsanders
The endpoint that Mike provided is good. I just used it this morning to write code that would track logins in mostly real-time (I don't have Live Events enabled, which would probably be easier). It probably would have been easier if I would have found Mike's post first, I stumbled upon it and just wondered what sorting by last_login would do and it added the last_login.
This will show the most recent logins across the institution:
GET /api/v1/accounts/self/users?sort=last_login&order=desc
What I did was extract the most recent date from my database and then fetch the information not following pagination to its completion, but only until I passed that previous date. I then run the code periodically throughout the day to update the last logins.
As I was reading through the source code changes mentioned in the 2020-07-29 deploy notes, I thought I found something new, but it turns out that some people knew about it back in 2018; perhaps it was undocumented.
For individual users, you can use
GET /api/v1/users/:user_id?include[]=last_login
:user_id can be the numeric Canvas user ID or you can use sis_user_id:5678 format.
This discussion post is outdated and has been archived. Please use the Community question forums and official documentation for the most current and accurate information.