How is a department added to a course offering?

A course offering is created using the CreateCourseOffering data structure (below) but this has no entry for "Department", which is included in the CourseOffering data structure, when the course offering is pulled from brightspace. How is department added to the offering via the REST API? I see no way in the reference at https://docs.valence.desire2learn.com/reference.html.
Thanks.
Course.CreateCourseOffering
{
"Name": <string>,
"Code": <string>,
"Path": <string>,
"CourseTemplateId": <number:D2LID>,
"SemesterId": <number:D2LID>|null,
"StartDate": <string:UTCDateTime>|null,
"EndDate": <string:UTCDateTime>|null,
"LocaleId": <number:D2LID>|null,
"ForceLocale": <boolean>,
"ShowAddressBook": <boolean>,
"Description": { <composite:RichTextInput> }, // Added with LP API v1.26
"CanSelfRegister": <boolean>|null // Added with LP API v1.28
}
Answers
-
Hi @D Gunter , thank you for your question. After performing some testing, I can suggest you the following API call to add the already created course offering under an existing department in the learning environment:
POST /d2l/api/lp/(version)/orgstructure/(orgUnitId)/parents/
Please find the documentation for the same below:
Here the orgUnitId parameter will contain the org unit ID of the course offering and the org unit ID of the department will be added after parents as a single JSON number.
-
Thanks Rishabh.
-
This does not seem to be the case, @Rishabh Kochhar. See my example below.
You can see that course offering 6626 has department 6650, but 6650 is not listed in the parents:
GET /d2l/api/lp/(version)/courses/6626
{'CanSelfRegister': False,
'Code': 'demo.instructor_sb',
'CourseTemplate': {'Code': 'ct_user_sandboxes_cb',
'Identifier': '6641',
'Name': 'User Sandboxes Container'},
'Department': {'Code': 'dept_Brightspace_Training_d2l',
'Identifier': '6650',
'Name': 'Brightspace Learning Area*'},
'Description': {'Html': '', 'Text': ''},
'EndDate': None,
'Identifier': '6626',
'IsActive': True,
'Name': 'Sandbox - Demo.Instructor',
'Path': '/content/enforced/6626-co_demo.instructor/',
'Semester': {'Code': 'SB_SEM', 'Identifier': '6655', 'Name': 'Sandboxes'},
'StartDate': None}
GET /d2l/api/lp/(version)/orgstructure/6626/parents/
[{'Code': 'ct_user_sandboxes_cb',
'Identifier': '6641',
'Name': 'User Sandboxes Container',
'Type': {'Code': 'Course Template', 'Id': 2, 'Name': 'Course Template'}},
{'Code': 'SB_SEM',
'Identifier': '6655',
'Name': 'Sandboxes',
'Type': {'Code': 'Semester', 'Id': 5, 'Name': 'Semester'}}]
Let me know what you think. Thanks.
-
Problem solved. Looks like it is an ancestor rather than a direct parent:
GET /d2l/api/lp/(version)/orgstructure/6626/ancestors/
[{'Code': 'KU',
'Identifier': '6606',
'Name': 'Top Level Organization',
'Type': {'Code': 'Organization', 'Id': 1, 'Name': 'Organization'}},
{'Code': 'ct_user_sandboxes_cb',
'Identifier': '6641',
'Name': 'User Sandboxes Container',
'Type': {'Code': 'Course Template', 'Id': 2, 'Name': 'Course Template'}},
{'Code': 'dept_Brightspace_Training_d2l',
'Identifier': '6650',
'Name': 'Brightspace Learning Area*',
'Type': {'Code': 'Program', 'Id': 101, 'Name': 'Program'}},
{'Code': 'SB_SEM',
'Identifier': '6655',
'Name': 'Sandboxes',
'Type': {'Code': 'Semester', 'Id': 5, 'Name': 'Semester'}}]
Another minor strange thing is that Department is actually Program. In one place Brightspace uses the term "department", in another "program". Do you know why this is? Seems confusing.
Thanks.