Any recent Changes to the Enrollment API

Jump to solution
EugeneChan
Community Member

So have been developing an application to manage courses and grant users permissions to said courses and was able to throw together a UI that creates a course, sets-up up content migration and adds a primary and secondary teacher to the course.

Doing some refactoring recently, adding other features and the last part (adding teachers) now fails.  I seem to get 400 codes whenever I make an API call to the enrollment API for the newly minted course.

Thing is - I make exactly the same call a little later and it goes through fine.

So I introduce a timer between creating the course and adding users to see if it helps and get it to work once with one user but not both - and then after that, it continues to fail even extending the timer to larger and larger values.

My question is - are there load and timing issues with newly created courses that I need to be made aware of and check for before I can enrol users into a course?

I should note this has been done pointing to a test environment - but it does make me worried even in a prod environment where there may be more resources in the back, can I come across a high load situation that will return similar errors?

Labels (1)
0 Likes
1 Solution
audra_agnelly
Community Champion

When testing, has the second (failing) user consistently been the same account?

So the app uses the one account to create the course and make the user enrollments. Is that the account you are referring to?

I was referring to the user account. My thought was that there may be an issue with that particular user account. If you are able to run the API for that user's enrollment later without issue, this would not be the case.

 

Canvas does throttle API requests, but you wouldn't be running into that with 2 enrollments. I can see where you may run into a timing issue between the course creation and the enrollment request. It is going to take a moment for the course to exist in Canvas, and beta/test are definitely much slower than production. But if one enrollment can be added the course is present and there shouldn't be any timing issue when adding the second enrollment.

View solution in original post

0 Likes