What is the path to get org unit paths?
This API route - PUT /d2l/api/lp/(version)/orgstructure/(orgUnitId) - requires Path as part of the OrgUnit.OrgUnitProperties
{ "Identifier": <string:D2LID>, "Name": <string>, "Code": <string>|null, "Path": <string>, "Type": { <composite:OrgUnit.OrgUnitTypeInfo> } }
However, the similar GET call does not return Path.
The Organizational Units data set does not include path.
The API route - GET /d2l/api/lp/(version)/orgstructure/ - does include path. However, it is paged result set that only returns 10 records per page, at least when using the query string ?orgUnitType=2.
If there are thousands or tens of thousands of an org unit type where the path is needed, what is the best way to get paths, in addition to name, code, orgunitid, and type?
Thanks
Answers
-
This is indeed a challenge with the Learning Framework API, and it seems like a good candidate for an enhancement request around the orgstructure API that retrieves the data for a single org unit by ID. However, you can use other filters on the orgstructure collection route which might assist in this case: you can use
exactOrgUnitCode
orexactOrgUnitName
to narrow the search down to the precise org unit in question if you already have its code or name -- you can also use the more generalorgUnitCode
andorgUnitName
to search for a list of org units with sub-string you provide in their Code or Name. These might be more useful to you thanorgUnitType
as a filter in this case. -
Would this GET request serve?
GET /d2l/api/lp/(version)/courses/(orgUnitId)
https://
docs.valence.desire2learn.com/res/course.html#get--d2l-api-lp-(version)-courses-(orgUnitId)
It does return PATH:
Course.CourseOffering
The service’s fundamental information block for course offerings. Notice that the some fields in this block include
BasicOrgUnit
blocks for the related org units.{ "Identifier": <string:D2LID>, "Name": <string>, "Code": <string>, "IsActive": <boolean>, "Path": <string>, "StartDate": <string:UTCDateTime>|null, "EndDate": <string:UTCDateTime>|null, "CourseTemplate": { <composite:Course.BasicOrgUnit> }|null, "Semester": { <composite:Course.BasicOrgUnit> }|null, "Department": { <composite:Course.BasicOrgUnit> }|null, "Description": { <composite:RichText> }, "CanSelfRegister": <boolean> }
-mike
-
Thanks for the replies!
Course Templates are the specific org unit type in this case, with the aim of updating both name and code for many, many, instances.
Looks like getting the list of orgunitids for CTs and then getting the data one by one.