Replies: 3 comments
-
Alright from my testing it is not possible to refresh the token in the middle of looping through objects created from the canvas object. Even if you refresh the original canvas object, the derived objects (accounts, courses, users) use the old token. This seems like something that can be improved upon for long running processes as we may need to do a lot of processing as a Canvas administrator. |
Beta Was this translation helpful? Give feedback.
-
Hi @refrain, As you've determined, each object carries a copy of the token, and any calls made from those objects will return new objects that make more copies of that token. Generally, we don't expect the objects to live in memory longer than the lifetime of an API token. Could you please elaborate on your use case for this behavior? It would help us figure out a potential solution. |
Beta Was this translation helpful? Give feedback.
-
I'm a programmer at a community college district, and one task I was doing for my dean is to find all "inactive" students for online only courses in a term, so that we can do some outreach to make sure they are able to login to Canvas. I would need to:
This code runs around 25min, but at this point, every additional API call added to the code can add 30min to the processing time (possibly due to rate limiting on instructure's side), because the API call has to be run on every enrollment of every course. Another project I work on is to scan a previous term's courses to copy to the next term's courses if the course_code matches. We have to take into account whether the new course has empty content, and that requires a lot of API calls to check each content bucket (quizzes, pages, announcements, assignments, etc). |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a long running process that utilizes the API. How do I get it to automatically refresh the access token so that I'm able to continue using my existing objects. Or do the objects (courses, users) have to be recreated after recreating the canvas object with the new access token?
Beta Was this translation helpful? Give feedback.
All reactions