uWaterloo / OpenData

Help and Support for University of Waterloo Open Data Initiative
https://api.uwaterloo.ca
90 stars 12 forks source link

Course Enrollment Endpoint #209

Closed james05 closed 3 years ago

james05 commented 3 years ago

In the older API, I am using the terms enrollment endpoint to get course enrollment information (enrollment total and enrollment capacity) for all courses in a term.

I notice in the new API I can only do this individually for a given course. So to repliace my functionality I need to do:

get courses using /v3/Courses/{termcode}

then loop through all courses invoking /v3/ClassSchedules/{termCode}/{courseId} for each course. This takes quite a lot of time for my needs. Is it possible we can get a similar endpoint to the old version in V3?

I am using like this:

https://api.uwaterloo.ca/v2/terms/#{term}/enrollment.json

As of issue creation /v3/Courses/1209 returns 6180 returns and so then I am making 6180 calls to the ClassSchedules endpoint which takes a really long time. There are ways to speed it up but I also don't want to get flagged for making a lot of requests.

sbobkin commented 3 years ago

Hi @james05,

Can you let me know a little bit more about the use case for getting enrollment information for every single class at the same time?

sbobkin commented 3 years ago

Closing at this time as I need more feedback to make any decision on this. Let me know if you can provide more information.

atomala commented 3 years ago

I'm updating my website (uwcourse.atomala.com) to use the new V3 API and I found that I have a similar situation. I need to request course enrollment data for every course in a specific term.

sbobkin commented 3 years ago

@atomala the API is primarily intended for real time data access. That is, we don't want use cases where it's scraped in bulk and then reused locally. At this time my suggestions in order of preference would be:

  1. Request the data in real time from the API as the user accesses the page where data is needed; cache locally if desired.
  2. Parallel your data copy requests to the Open Data API. There is no throttle limit on the API or the servers hosting it, and we can increase resources if performance becomes an issue.
  3. If there are more requests for this particular data in bulk, we can investigate it, but it is low priority because it's on the edge of the design goal for the API, and is a niche use case.