The Instructure Community will enter a read-only state on November 22, 2025 as we prepare to migrate to our new Community platform in early December. Read our blog post for more info about this change.
Found this content helpful? Log in or sign up to leave a like!
I'd like to know how to generate the PageViews_for_<User>.csv file that you can get when you click on the Download as CSV button. The endpoint is <url>/<user_id>/page_views.csv that I can see in the network tab of my developer tools:
I suppose using a GET request would do the trick but I need to narrow it down to a specific date range. The reason is that I'd like to programmatically get all the same fields that the downloaded CSV has. Using a PageView object leaves out a lot of extra useful fields that are in the CSV that you can download from the Canvas UI.
Thanks in advance
Solved! Go to Solution.
I just checked, and the PageView endpoint returns the same data as the CSV for my site. I'm curious which fields are missing?
you can try appending these parameters to the end of the URL:...com/page_views.csv?start_time=2025-02-17T13:00:00.000Z&end_time=2025-02-19T13:00:00.000Z
The date and time will need to be in ISO 8601 format. E.g. for 2025-02-17T13:00:00.000Z
2025-02-17 represents the date (year-month-day).T is a separator between the date and time.13:00:00.000 represents the time (hour:minute:second.millisecond).Z stands for Zulu time, which is another way to represent UTC (Coordinated Universal Time).
I just checked, and the PageView endpoint returns the same data as the CSV for my site. I'm curious which fields are missing?
you can try appending these parameters to the end of the URL:...com/page_views.csv?start_time=2025-02-17T13:00:00.000Z&end_time=2025-02-19T13:00:00.000Z
The date and time will need to be in ISO 8601 format. E.g. for 2025-02-17T13:00:00.000Z
2025-02-17 represents the date (year-month-day).T is a separator between the date and time.13:00:00.000 represents the time (hour:minute:second.millisecond).Z stands for Zulu time, which is another way to represent UTC (Coordinated Universal Time).
@jerry_nguyen That did the trick. I don't know how one would be able to learn that by reading the API documentation. Your assistance is appreciated.
To answer your question a PageView object has a total of 17 properties and the CSV file has 2 additional properties for a total of 19. Also I've noticed in some of my research of logs needed for instructors request of academic dishonesty allegations on Respondus Lockdown Browser where 2 devices are opened simultaneously, the user_agent property/field ends up with blank/empty strings whereas the CSV file seems to be a bit more reliable with respect to the user_agent value.
In my particular case the instructor has students allegedly having a mobile device within their field of view of the student's monitor/laptop screen and wants me to provide a spreadsheet showing proof of that being the case with the student. Since the UI only returns 100rows of data with a CSV file, this will help me more specific with the time range and more reliable data to go with it.
Haha, nothing special. I just used the good old developer tools like you did and put a date into the "Filter by date" search box to see what it does.
Community helpTo 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