Celebrate Excellence in Education: Nominate Outstanding Educators by April 15!
Found this content helpful? Log in or sign up to leave a like!
Updated
Original Subject Line: How do I get Attendance Report using API (and not logging into Canvas through browser)?
What is the REST API call to get the attendance report for a class (or many classes) for a given time period ?
Message was edited by: Chris Hofer
Solved! Go to Solution.
I'm not aware of any REST API call that will return the attendance. It is an LTI application ran from rollcall.instructure.com and not native to your instance of Canvas, which is where the API works from.
If you're a teacher and only have access to your courses, then you can do the following:
Once you have launched it from Canvas, you can then visit https://rollcall.instructure.com/reports/new?course_id=#### (where #### is the same as your Canvas Course ID) and get a form that is used to start the report. You can fill it out the form and then click the Run Report button. Then it emails it to someone rather than providing it as an export. If you try to make the call directly from Canvas, then you get the warning "Please launch this tool from Canvas and then try again.", which is typical of LTIs.
One possibility would be to use a headless browser like PhantomJS or CasperJS to log into Canvas, launch the Attendance feature once from a class to make sure the LTI information is set, and then call the form and click on the button to generate the report. You could loop through the different courses that you needed to obtain the report for, or you could set it up with a command line parameter that took the Canvas course ID.
Of course, the reports are still emailed to the address you supply. Depending on your email system, you might be able to set up a script that automatically processes the email notification and then downloads the file using the supplied link. You have 24 hours from the time you generate the report to download it.
If you're an admin, then there is an Attendance navigation link from the Managed Accounts page.
You could can do much the same thing from there as I described above, and it might even be easier.
There is a specific URL that will take you to the the Export Attendance Data page. It's the one that you get when you click on the Attendance button. The export form loads in that page without having to mess with the attendance portion of Role Call that normally appears when you click on Attendance within a class setting.
It's still in an iFrame, though, because it is an LTI application.
However, CasperJS provides the withFrame() method that will allow you to switch to the iFrame where you can then fill out the form and submit it. PhantomJS has switchToFrame() that should accomplish that as well.
Note that if you go this route, you'll need to use the SIS Course ID rather than the Canvas Course ID.
The admin interface also allows you to get attendance for all courses, but only for a 7 day period. This means you could set up some kind of job that ran at least once a week and then combine each report together to get the attendance for all classes for an entire term (or however long you need).
If you have a lot of classes that are using the Attendance feature, it will probably be faster to piece it together this way (16 calls and get an entire semester vs 1 call for each class).
Hi @mshah1 ...
In order to make your topic more searchable here in the Canvas Community, I am going to move the subject line of your question down to the body of your message as well as tag you message with keywords. Both of these things will make it easier for people to search for similar topics here in the Community. I'll provide a shorter subject line. If the revised subject line doesn't accurately reflect what you are asking in the body of your message, please let me know, and we can make any necessary changes. I hope this is okay with you.
Thank you.
No problem! Also, while I think of it, I'm going to share your question with the Canvas Developers group here in the Canvas Community. This will hopefully get your question a bit more exposure. If you're not following that group, you might want to do so.
I'm not aware of any REST API call that will return the attendance. It is an LTI application ran from rollcall.instructure.com and not native to your instance of Canvas, which is where the API works from.
If you're a teacher and only have access to your courses, then you can do the following:
Once you have launched it from Canvas, you can then visit https://rollcall.instructure.com/reports/new?course_id=#### (where #### is the same as your Canvas Course ID) and get a form that is used to start the report. You can fill it out the form and then click the Run Report button. Then it emails it to someone rather than providing it as an export. If you try to make the call directly from Canvas, then you get the warning "Please launch this tool from Canvas and then try again.", which is typical of LTIs.
One possibility would be to use a headless browser like PhantomJS or CasperJS to log into Canvas, launch the Attendance feature once from a class to make sure the LTI information is set, and then call the form and click on the button to generate the report. You could loop through the different courses that you needed to obtain the report for, or you could set it up with a command line parameter that took the Canvas course ID.
Of course, the reports are still emailed to the address you supply. Depending on your email system, you might be able to set up a script that automatically processes the email notification and then downloads the file using the supplied link. You have 24 hours from the time you generate the report to download it.
If you're an admin, then there is an Attendance navigation link from the Managed Accounts page.
You could can do much the same thing from there as I described above, and it might even be easier.
There is a specific URL that will take you to the the Export Attendance Data page. It's the one that you get when you click on the Attendance button. The export form loads in that page without having to mess with the attendance portion of Role Call that normally appears when you click on Attendance within a class setting.
It's still in an iFrame, though, because it is an LTI application.
However, CasperJS provides the withFrame() method that will allow you to switch to the iFrame where you can then fill out the form and submit it. PhantomJS has switchToFrame() that should accomplish that as well.
Note that if you go this route, you'll need to use the SIS Course ID rather than the Canvas Course ID.
The admin interface also allows you to get attendance for all courses, but only for a 7 day period. This means you could set up some kind of job that ran at least once a week and then combine each report together to get the attendance for all classes for an entire term (or however long you need).
If you have a lot of classes that are using the Attendance feature, it will probably be faster to piece it together this way (16 calls and get an entire semester vs 1 call for each class).
I have admin privileges, and I know how to get one class at a time per day in the attendance export section. My question is if I want to check certain classes possibly per hour or end of day instead of having a mass attendance of all my classes. Is there a way of doing that? The attendance feature is a great thing but it doesnt help for reporting or keeping track short or long term from an administrators side of things. Any insight would be helpful.
Mike
You can use the report to get the attendance for all of the classes (for up to a week at a time) and then apply filtering after the download using Excel. There's nothing to say you can't do that multiple times a day. Making it a table in Excel and then applying sliders or filters should make it less painful.
There is not, that I'm aware of, any way to filter by date and time when making the call. That would not make sense when you look at the data since the enrollment is based on the date and doesn't include the time and the timestamp column that is there corresponds to when the data was entered and not necessarily to the date of attendance (I had a teacher enter attendance for June 6 on July 18).
Note that the correct server matters, for EU customers:
https://rollcall-eu.instructure.com/reports/new?course_id=xxxx
Using the wrong server returns
Please launch this tool from Canvas and then try again.
Has anything changed since then? Can the API access attendance rolls? For K12, attendance is an important information to parents which I am interested to write an application for.
Has there been any updates or changes on this?
Nothing has changed on the Canvas end.
I didn't remember writing this answer in October 2018 when I needed to pull attendance out of Roll Call, so I did it without using Casper or Phantom, but just using Node JS (which is much more common). The trick there is to launch a sesssionless LTI call using the Canvas API. Once you have that session, you are basically logged into Canvas and can make the calls to generate the request.
For a truly automated system, you need to have the email come to an address that can act on it. I use one dedicated for that purpose and I added a mail filter (milter) to the add the information to a queue (you need to return a code right away with the milter). Then I process the queue every 5 minutes to download any previously unfetched reports and stick the information into a local database.
Let me get this straight:
Instructure provides NOTHING for institution-level attendance reporting? There's no way provided to use Roll Call data to get Last Date of attendance for the financial aid people? No way provided to get the data for creating retention alerts for at-risk students? No way provided to get the data to facilitate institutional attendance policies?
Our only option is an insane work-around involving browser automation, checking for a link via email, in separate requests either per-course or per-week? Then we have to process individual attendance events to get an idea of the current state for each enrollment?
And they haven't made any improvements to the situation after more than 4 years?
This is a SERIOUS step backwards from what we've had!
Canvas does have a partner that provides a standalone attendance reporting solution: aPlus Attendance has a partner page right here in the Community:
https://community.canvaslms.com/t5/Partner-Listings/Partner-Listing-aPlus-Attendance/ta-p/437815
@jcoehoorn Canvas has developed an online attendance feature that can be accessed through New Analytics. Please read through Canvas Release: New Analytics - Online Attendance.
@Stef_retired That's still a per-course LTI, and it still only shows individual events. There's no institution-wide information, no programmatic access for custom reporting or processing alongside SIS data, and no per-enrollment summary.
That's largely correct, @jcoehoorn . It's a new tool for course attendance that provides a platform for additional enhancement. If you'd like to join the conversation about it, please follow the product manager's blog posts: Get a Canvas Attendance update, meet a new product...
We are on the same boat, and are on the process of implementing Canvas as I'm typing this.
Aplus attendance advertises an API - we are kind of banking on that right now. We have a demo scheduled with them and can update this comment once we know more!
Just here to state that this is indeed a problem still!
It is very disappointing that Canvas' API does not support system level attendance monitoring without a paid add-on.
To participate in the Instructure Community, you need to sign up or log in:
Sign In