User Page Views CSV generation - How Do I get PageViews CSV for a specific date range via API
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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).