On the test instance is there is limit to api call speed?
I am using the api to inactivate the section enrollments of students that have left a course. I am testing it in our test instance and initially the app would do a dozen or so api calls and the stop getting a response from canvas. I inserted a sleep of a couple seconds between calls and it to processed a lot more calls before doing the same thing. I am trying to figure out if this is an issue on my end, some limitation on the test instance or if it is a limitation on all instances.
One thing I have encountered is that the amount of cloud computing resources dedicated to non-production instances of Canvas are significantly less than the production environment. Even when accessing the admin area in the test or beta environment with my web browser I've had the request time out on occasion. Our institutional cloud contract includes a 'sandbox' instance of Canvas that isn't synced with the production environment and seems to be on par with the resources allocated to our production environment. So for testing speed of API calls I test against that after importing any needed course information from the production environment. That way I can just swap out the URL for the production environment when I need.
I find the test instance to be quite slow, sometimes maddeningly so. The beta instance regularly times out on me.
Just to be clear this is running in the test instance. It is manipulating enrollment records so that is not something I would test in prod. If others are having timeout issues in test I will run with the idea that it may not be an issue on my end and test accordingly.
I have found that test and beta can sometimes lag a bit, but not to the point of frustration.
The only significant issue I've had with test and beta has been associated with testing SIS imports.
Apparently we are all sharing a workflow queue in these environments, so if someone is testing a long running job at the same time you are, you might have to wait a while. My specific scenario was uploading a small SIS import file and watching the status sit at 0% for an hour before it started to process.
Honestly I have not experienced any timeout issues when testing API calls. We run several complex algorithms that make multiple API calls, and timeouts have never been an issue. One API call that can take a long time to return is related to course analytics, and even that does not timeout for us.
I am trying to get a email notification sent for an enrollment invitation and the email never gets sent. Sending a message to the same user via the ui widget works fine. Can anyone tell what I am missing? Appreciate your looking.
-X POST \
-F 'enrollment[user_id]=sis_user_id:jpg_goog' \
-F 'enrollment[type]=ObserverEnrollment' \
-F 'enrollment[enrollment_state]=invited' \
-F 'enrollment[notify]=true' \
-H "Authorization: Bearer `cat ~/canvas/tokens/sis@canvas`"
The enrollment get created:
If you're getting a HTTP 200 OK response from the API and you see the observer role in the enrollments, I might wonder if something simple like the course being in a published state is all that's missing? If the course is unpublished notifications don't get sent out.
Thanks for the reply and thatv ery reasonable guess. The test course was indeed not published but after deleting the enrollment, publishing the course and retrying the api call again, still no email. I also created a new course (different sis_id), published it, and enrolled same user in it, in case there was any kind of object conflict with the old enrollment... and still no email arrives and nothing in Spam folder
I made a simple python program to get information about both users and students in a course with the output formatted as a spreadsheet (.xlsx). One of the features of this program was to get the various communication channels associated with each person. Adding and removing Twitter as a registered service revealed that there is a need for a third value ('inactive') for the "workflow state" associated with a communication channel. For details can code see List of users and students in a course: Chip sandbox
Note that the program could be split into a list users program and a list students program, but this example of using the API was relatively simple and illustrates the power of the API.
When I try to get a list of my courses using the get URL: ...api/v2/courses I get only 10 of my courses.
I have read the documentation for this call a dozen times and cannot spot where it hints that this is the expected behavior for this call.
I see this with browsers but also when I try to use VBA coding. It is a problem because the most important courses for me are not in the returned list.
I have many more courses on the books (the Canvas GUI lists 26 which are currently relevant).
What do I have to do to get ALL my courses for the current quarter.
What would the URL look like to get all the current and future courses where I have at least one student enrolled?
EDITING to Add: I posted the above without realizing that there were already 8 pages in this thread. (I am relatively new to Canvas and very new to this Forum)
On one of the earlier pages in this thread I learned that pagination is used for some calls It appears that the documentation is failing to identify that paging is needed for this. Perhaps this could be added.
If I run into other API calls were paging is needed, how do I know this is happening. In other words, how do I know that when I make the call as documented, that the returned data is paginated? I have been making API calls and staring at JSON responses all day (with VBA in Excel) and noticed nothing that would give me a hint to this. I did now find the documentation on Pagination but do not understand it; what and where is the Link header? I do see a vague hint on that page that I could pass the a parameter to force the page size to some "unspecified number". What is the syntax for that?