ben_mcmurry
Community Member

Using REST API to get User Activity

I've searched and couldn't find what I've been looking for, so I hope this isn't a duplicate. 

I need a report of student activity for all students enrolled in a course in a term. I'm not really a programmer, but I've ben able to create an LTI and use REST APIs for other tasks, so please forgive my ignorance on terminology and what not.

Thus far, I can't find an endpoint that gets what I'm looking for. This is the only workflow that I can come up with, but it seems really messy. I'm hoping someone on here has a better idea.

First I use https://domain.instructure.com:443/api/v1/accounts/1/courses?enrollment_term_id=57 to get the courses for the term.

Second, I loop through https://domain.instructure.com:443/api/v1/courses/COURSE_ID_HERE/enrollments?type[]=StudentEnrollment to get a list of all students enrolled in each course.

Third, I loop through every user with https://domain.instructure.com:443/api/v1/users/USER_ID_HERE/page_views?start_time=START_DATE_HERE&e...to see page views

Basically, I just want to get a list of users who used canvas on a given date or range of dates. I don't really care what pages they looked at. I did try just getting login events and that was great accept it didn't account for those who stayed logged in across days or those that were using the mobile app. 

If someone could point me to the correct endpoint, that would be excellent.

8 Replies
bneporadny
Community Champion

Hi Ben,

There might be other ways to get the data you're looking for, it just depends on your definition of "used". Canvas offers a few canned account reports, that might meet your needs. 

  1. last_enrollment_activity_report‌ - This report will allow you to quickly and easily see the last time a student did some short of enrollment activity.  (https://community.canvaslms.com/message/116096-re-last-enrollment-activity?commentID=116096#comment-...
  2. student submission‌ report - This report will allow you to tell when the student last submitted a graded assignment. (Student Submission (account reports))

Hope one of these options helps and meet the needs for what you're looking for. 

0 Kudos

Thanks. Both of those are good options, but don't give me what I need. I need to be able to go back to any day and see which users did anything on canvas. The last_enrollment_activity_report would work moving forward if I checked everyday, but it wouldn't help with past data. The student submission would show if a student logged in for the day and only checked grades, messages, or they syllabus, etc.

Thanks for the suggestion, though.

0 Kudos

Hi Ben,

Based on your response and what you're looking for, the way you're doing it is the only option you have if you want to be able to do it on the fly, without a need to capture data on a daily basis. 

The only other option you have that I am aware of is if you wanted to use #canvas data‌. If you were to use it you would be able run a query to pull the information you're looking for, but this too would require you to have a local database, unless you pay for Canvas to host the data for you. 

0 Kudos
Chris_Munzo
Partner
Partner

ben.mcmurry‌ -- I'm not sure if you are aware of our LTI solution called Dropout Detective, but it reports a great deal of information on student engagement -- latest submission dates, latest course access dates, grades in all courses, and other data.  Please let me know if you'd like to learn more.

ShelenaCofield
Community Member

@ben_mcmurry  I'm currently trying to do what you requested on this thread. Did you use your solution or come up with a different way of finding out what users were using Canvas on a daily basis?

0 Kudos

It's been a long time. I ended up writing a PHP script that our staff could use. They entered the date and would get a list of users that hadn't logged in on that date. It wasn't ideal, but it worked. I had to manually export currently enrolled students for each semester that we used this for. I don't know if that helps.

0 Kudos

Sorry. I responded from my canvas free account. I'm the same person though. I promise.

0 Kudos
ShelenaCofield
Community Member

Thanks @ben_mcmurry@benmcmurry for your input.

0 Kudos