OMG never new this ENV variable existed
where is documentation of this witchcraft?
I don't think there's documentation, not even really sure it's there for us/developers, I think we just found it and started using it?
The rate limiting question is hard to evaluate without more details, and honestly I've never worried about it, and I've done some pretty terrible things against production, but not as crazy as @James and his concurrent data pulls. He definitely has more insight here than I do.
One thing to remember is that each user is using their own quota.
For more info read,
API Rate Limiting
Dynamic Throttling Implementation using rate limit header
Is there any limits on the number concurrent calls to canvas REST API?
If you are writing something for use within Canvas Themes those requests are limited as the user. Never use your own token in a theme hack. If you are using an LTI or something that uses a developer token, have the user issue the token, not your own.
if a parent has 6 kids that is 7 api calls...
More than that :smileygrin:
// when I first read that, I saw it as a student with 6 courses, leaving this bit for detail.
The user page_views endpoint is by user, not by course. If you want to split the data by course, you'll have to code it.
{
"url": ".../courses/1234/files/6789/download?wrap=1",
"context_type": "Course",
...
"links": {
"user": 4567,
"context": 1234,
...
},
...
}
// 6 kids is 6 requests + pagination
By default you will get 10 rows from the end point, with pagination you can get 100 rows at a time, collecting additional page views with additional requests.
Pagination - Canvas LMS REST API Documentation
Handling Pagination
but am I approaching this in the right way?
With the API you always have to start with what's available, but after that, the options are in your imagination and desired product.
Scope
How many users are you expecting, how many of your observers log in each week/month/term?
What are you trying to show the observers, what do they want to see?
Is it a theme hack or an LTI?
Do your observers use the Canvas Parent app, or do they use the desktop/browser?
User Experience
What does the user see when they get to your feature?
Will they get just a long list of page views? Can you load the most recent 100, and build in something like an infinite scroll that collects/shows more if they browse that far?
The following get considerably more complicated, because you have to do enough collection to gather the data and split by course or range...
Can you give them a date picker and let them set a range? Then break the results up by course?
Can the observer click into each course instead of seeing hundreds of page views per course on 1 page...
maybe they don't want to see every course all at once, but are checking into activity of just 1?
Since the endpoint has a date range param, maybe you could default them to the current week, and then give them a month filter or the ability to scroll back to see previous weeks?
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.