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.
Hello all,
I am playing around with the API reports and I was trying to do the GET for page views. Only I can't seem to get the date format to work. It wants a start date and an end date. I put in the following formats and no luck:
2015-06-01T00:00:00
2015-06-01 00:00:00
2015-0601T00:00:00UTC
Can anyone shine some light on this? Thank you so much!
Shannon Hight
Solved! Go to Solution.
shight,
They use ISO8601 format, which is set to UTC rather than local time.
YYYY-MM-DDTHH:MM:SSZ
The T and the Z are the literal characters T and Z.
This is documented in the SIS Imports API: Canvas LMS REST API Documentation
shight, I'm going to move this highly specialized question to the Deactivated user space and will tag Canvas Developers so that it gets proper focus from the right audience.
shight,
They use ISO8601 format, which is set to UTC rather than local time.
YYYY-MM-DDTHH:MM:SSZ
The T and the Z are the literal characters T and Z.
This is documented in the SIS Imports API: Canvas LMS REST API Documentation
I tried that format, but I still am not getting a response. In the response body I just get []. No text or anything. Have you ever used this API for the page views of a user? I can pull up the Profile and her avatar. Just nothing under page views. I do know that she should have something for the last few weeks.
Thank you so much for the format. I'm one step closer.
Shannon
shight,
I used it this morning at 12:11 am. I wrote a script that will download all page views for all students in the class and tell which pages they've looked at and I'm appalled at how little my students are looking at the material I put out there (especially the study guide for today's exam -- remember this was this morning I checked).
But, that timestamp is optional, so leave it off and see if you get anything. If you still don't, then the problem is somewhere else and not with the formatting of the time.
You might also want to verify the calling syntax with the Live API for your site: https://MYSITE.instructure.com/doc/api/live
Enter your access token at the top and then scroll down to the Users API and then choose List user page views
Only the user_id is required and for testing purposes, be sure to use the Canvas User ID rather than your SIS user id (eliminating more areas that could go wrong).
The other thing I use for testing is the Advanced REST client for Chrome.
Got it to work. I have to be on my live site, it wont work on the Test site or the Beta site. It is only giving me a few entries. That is why I wanted the range but it looks like my students are not logging in very much, but I know they are. Is there a trick to make it give me more?
Thank you so much for the help with this.
I send the parameter per_page=100 with the request, otherwise you get the default, which is 10.
If there is more than 100, then you need to go with pagination. You can also use pagination with less than 100, but it takes longer.
Hopefully you're using a library to perform the REST operations on the API (they have them for most programming languages). Some of them will automatically handle pagination. I wrote my own for PHP and so I had to look for a "Link" header response and then grab the rel="next" link from that.
A very brief overview of pagination is in the API documentation: Canvas LMS REST Pagination API Documentation
Got it. Thank you so very much. I knew there was something I was missing but being self taught I just didn't know what to look for. Baby steps but I'm getting there. Thanks again!
Shannon
We are giving the Canvas Admins area a little bit of love (especially questions that are really, really old) and just want to check in with you. This will also bring this question new attention.
Were you able to find an answer to your question? I am going to go ahead and mark this question as answered because there hasn't been any more activity in a while so I assume that you have the information that you need. If you still have a question about this or if you have information that you would like to share with the community, by all means, please do come back and leave a comment. Also, if this question has been answered by one of the previous replies, please feel free to mark that answer as correct.
Robbie
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
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.