How to add a course to a parent topic via the API

Options

If I use the UI, go to Org Unit Editor, and select a course offering, I can then click 'Add Parent' search for an org unit (such as a topic) and add it.

How do I do this via the API if I know the course org unit ID and the ID of the topic org unit?

@Ian.P.710 , @Chris.S.534 hopefully one of you guys know? or others??

Tagged:

Answers

  • Ian.P.710
    Options

    Take a look at https://docs.valence.desire2learn.com/res/content.html
    Specifically on that page look at
    POST /d2l/api/le/(version)/(orgUnitId)/content/modules/(moduleId)/structure/

    Add a child module or topic to a specific module’s structure.
    or depending on what exactly you are looking to do
    POST /d2l/api/le/(version)/(orgUnitId)/content/root/

    Create a new root module for an org unit.

  • Richard.R.305
    Richard.R.305 Posts: 20 🌱
    Options

    @Ian.P.710

    I tried /d2l/api/le/(version)/(orgUnitId)/content/modules/(moduleId)/structure/ yesterday. I keep getting a 404.

    Like I said, I'm trying to replicate this: In the Org Unit editor, I select a Course Offering X and then I click 'add parent' and select Topic Y

    In the api:
    For orgUnitId, I set this to Course Offering X (I am using the id of a course offering —> this is the item I want to "add parent" topic to)
    For moduleId, I set this to Topic Y (the ID of the topic —> this would be the 'parent')

    In this scenario, I'm using the ContentObjectData JSON data block of type Module. Is this right? (I tried Topic type also but get the same error, 404)

    For the 'module' json, this is my structure:

    {
    "Title": "new title",
    "ShortTitle": "new short title",
    "Type": 0,
    "ModuleStartDate": null,
    "ModuleEndDate": null,
    "ModuleDueDate": null,
    "IsHidden": false,
    "IsLocked": false,
    "Description": "new description",
    "Duration": null
    }