Your Community is getting an upgrade!
Read about our partnership with Higher Logic and how we will build the next generation of the Instructure Community.
Hello there, @udelhsar ...
I am sorry to see that your question has been sitting out here unanswered since early December. I'm not sure if you've been able to find a solution to your question on your own (if so, would you mind posting your findings below?), but I wanted to check in with you either way. I'm going to share your question with the Canvas Developers group here in the Community in hopes that your question will get some additional exposure, too. If you aren't yet following this group, there are two buttons at the top of the page I linked to which you can click on: "Follow" and "Actions" >> "Join group". For now, I'm going to mark your question as "Assumed Answered"...not because we've been able to find a solution for you...but more because there hasn't been any activity in this topic for over six months. This won't prevent you or others from posting additional questions/comments below. I hope that's okay with you, Sara. Good luck...take care...be well.
Let me start with what won't work before I show what will work.
Finding out when a student was enrolled in the course can be obtained from the web interface.
If you click on the People page and then click on the more options (3 vertical dots) for the user, choose User Details
There you will find a Memberships section that lists the sections they are in and when they were enrolled in that section.
The pathname (the portion after the hostname) in the location bar of the browser will look like /courses/1234/users/56789
Unfortunately, the information about the date they became inactive is not there.
To get that information, you need to fetch data from the Canvas REST API. There is a Get a single user within a course that sounds promising and all it would take is to add /api/v1 in front of the existing pathname, but that doesn't give the dates.
To get the date that they dropped, what you need to do is get the enrollment record for the student for that course.
I'm working with course_id = 1234 and user_id = 56789 in this example.
In your browser, add this to your hostname in the the location URL and then press enter:
/api/v1/courses/1234/users?include[]=enrollments&enrollment_state[]=inactive
The include[]=enrollments is necessary to get the dates and the enrollment_state[]=inactive is because inactive students don't normally show.
You will get a bunch of computer friendly code beginning with while(1);. Take everything after the while(1); highlight it and copy it. Then paste it into an online JSON Formatter such as the one at CuriousConcept or another site that Google returns for you.
Once you process the JSON, you should get an array of entries, one for each inactive student in your class. Go through and look for the one you want. You may be able to use the find functionality of your browser to help.
Under this student, there should be an enrollments array with one object for each enrollment in the course they have (normally one per section).
The updated_at date is the date their enrollment was last changed. In this case, since the switch to be inactive was the last change that happened, I can tell it happened at 8:45 pm CDT on June 9, 2020. The date and time given are in UTC and I'm in Illinois, 5 hours behind UTC during Daylight Saving Time. If you're not sure how to convert the time Canvas gives, it's in ISO8601 format, so something like the ISO8601 Date Converter online tool at DenCode can help. Note that even though I'm on CDT right now, the timezome is specified as if it was on CST (6 hours behind UTC). Illinois and Iowa could use "-0600 America/Chicago"
If you have more than 10 inactive students in the course, then this may not show the one you want. You can add &per_page=100 to the end of your query to get up to 100 at a time or you can go &page=2 to get the second list of 10 students or &page=3 to get the third set of 10 students. The &per_page=100 is easier since you won't know ahead of time which page the student appears on.
I would also point out that you do not have to go to another website to format the JSON so that it looks nice. This is especially true if there is only one inactive student. You can try to decipher it without the formatting, perhaps even using the browser's find to look for "updated_at" and then take the date that comes right after that.
To interact with Panda Bot, our automated chatbot, you need to sign up or log in:
Sign InTo interact with Panda Bot, our automated chatbot, you need to sign up or log in:
Sign In
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.