Search code examples
desire2learnvalence

Enrollment information


I'm looking for the most effective way to extract the following information from D2L.

For a given user find all Department in which he is not enrolled, but is enrolled in any Offerings belonging to this Department.

The only solution I see is:

  1. Call GET .../enrollments/users/{id}/orgUnits with type = Offering into List1
  2. For each entry in List1 call GET .../courses/{courseId} to get course department information and build on-the-fly List2 of unique departments.
  3. Call GET .../enrollments/users/{id}/orgUnits with type = Department into List3
  4. Compare List2 vs List3

It's obvious that if user is teaching many Courses then too many calls will be required in step2.

Any suggestions are greatly appreciated.


Solution

  • For your step 2 which starts with the set of the student's enrolled course offerings, you may find it easier to call GET /d2l/api/lp/(version)/orgstructure/(orgUnitId)/ancestors/ to find all the departments containing those course offerings, and produce your List 2.

    Unfortunately, the Valence Learning Framework doesn't really give you any set-predicate API calls around the org structure (to determine if a given orgUnit Y is a descendant of another orgUnit X, and so forth).