Is there an API call that allows you to sort if a user has logged in since a certain date? We are doing some spring cleaning and are trying to sort out current staff from staff that has transitioned.
There's not really a "logged in since..." API, but certain calls within the Users API can get you the last time the person logged in. For instance, if you grab all the users in the account and sort by last login:
you get back the last login date as part of the user record for all the users in the account. I'm not sure what it does with users who have never legged in, though.
You can also get at this information for a specific user (kind of) by looking for the last page view for that user:
And of course, you can also run the "last access" report under Settings > Reports.
Other folks may have better ways to gather this info, though!
the enrollments API also includes a "last_activity_at" field which can be queried on a course-by-course basis. Here's an example of adding an indicator to the people page for those that have been active recently:
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:
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
:user_id can be the numeric Canvas user ID or you can use sis_user_id:5678 format.