How to retrieve the hierarchy down to the course offering level

30 views
Skip to first unread message

Jeffrey Kahn

unread,
Jul 14, 2014, 7:55:01 PM7/14/14
to valenc...@googlegroups.com
I am uncertain how to descend through the various containers to ultimately discover all course offerings in a d2l instance.

Perhaps I start with: 
GET /d2l/api/lp/(version)/organization/info 
but, while this returns an ID, I don't believe it is an orgUnitId.  So, next I tried:
GET /d2l/api/lp/(version)/orgstructure/ 
but that didn't work.  I think I want to get to this: 
GET /d2l/api/lp/(version)/orgstructure/(orgUnitId)/descendants/
and eventually:
GET /d2l/api/lp/(version)/courses/(orgUnitId)

Can someone suggest the right way to navigate these?
Jeff

 

Desire2Learn Staff: Viktor

unread,
Jul 15, 2014, 11:06:35 AM7/15/14
to
Hi Jeff,

The best way to do this will vary with the API versions offered by the back-end service, I believe.

If you're using Learning Suite v10.3.0 or later (and you have access to the LP v1.4 API contracts), then you can use the GET route that operates on the entire organizational structure, and query-filter on orgUnitType (by ID) to select the course offering org units.

If you're using a Learning Suite prior to v10.3.0, then the process is more cumbersome:
- First, fetch the root org unit's info, so you know what org unit ID it has.
- Then, using the root org's ID, you can find all its descendants. Presuming that your using Learning Suite v10.1.0 or later (and if not, you ought to be, because at this point LS versions 9.4.1 and 10.0.0 are a month away from their end-of-life), you should use the route that returns results in data pages, because it's likely that the list of all course offering descendants from the root org unit is of considerable size. In any case, with the older routes that got properties for children/parent (one generation removed) and ancestor/descendant (n generations removed) org units, you can use the ouTypeId query parameter to filter results down to particular org unit types (by ID).

Once you have the org unit ID of a particular course you're interested in, you can use the GET course offering route to retrieve it's properties as a course -- the various routes for navigating the organizational structure will provide you only with the properties that org unit nodes have as generic org unit nodes.

Desire2Learn Staff: Viktor

unread,
Jul 15, 2014, 11:10:15 AM7/15/14
to valenc...@googlegroups.com
The Identifier property in the Org.Organization structure is the org unit ID for the root org unit node.

Jeffrey Kahn

unread,
Jul 15, 2014, 12:00:07 PM7/15/14
to valenc...@googlegroups.com
Viktor,

This worked, thanks for the prompt reply.  
I need to use older form.  I had not used the paged form earlier or I might have stumbled on the solution.

Jeff  

Desire2Learn Staff: Viktor

unread,
Jul 17, 2014, 9:04:14 AM7/17/14
to valenc...@googlegroups.com
No problem; we'd recommend that you use the paged calls whenever possible. Frankly, we don't have enough of them and using routes that can return unbounded data without the paging can lead to some uncomfortable situations. With many clients, it's not a problem, because their data sets are rather small; but some clients have very large org structures, or very large user bases, and etc. In those cases, using an unbounded call can have problems (with the size of the data set returned to the calling app, and, in some cases on the back-end service itself) so it's best to use the paged call variants and query parameter filters when you can.
Reply all
Reply to author
Forward
0 new messages