Update CanSelfRegister course offering

Ruud.K.955
Ruud.K.955 Posts: 9 🌱

Hi all,

I'm trying to update an existing course offering via the Brightspace API, and I suspect the issue is related to the CanSelfRegister field.

I'm sending the following JSON body in a PUT request to:

PUT /d2l/api/lp/1.51/courses/6671

Here is the body:

{
"Name": "Ruud Koopmans Sandbox",
"Code": "SB_r.p.m.koopmans",
"StartDate": null,
"EndDate": null,
"IsActive": true,
"Description": {
"Text": "",
"Html": ""
},
"CanSelfRegister": false
}


Is CanSelfRegister supported for PUT requests on the /courses/{orgUnitId} endpoint? Or is it only supported during course creation?

Any help or clarification would be appreciated.

Thanks a lot in advance!

Ruud

Comments

  • Joshua.G.520
    Joshua.G.520 Posts: 8 🌱

    Hi Ruud,

    I have an API tool that uses a PUT call to this endpoint: /d2l/api/lp/1.46/courses/OU# and it is working okay with the CanSelfRegister field. Two possible problems with your call 1. your version is 1.51 but the highest supported in the API reference is 1.46. Also, you'll need to adjust the structure of your JSON. I have this:

    {
    "Name":"Course Name",
    "Code":"Course Code",
    "StartDate":null,
    "EndDate":null,
    "IsActive":true,
    "CanSelfRegister":true,
    "Description":{
    "Content":"",
    "Type":"Text"
    }
    }

    Seems to work just find for me. Hope this helps!

    Josh.

  • Ruud.K.955
    Ruud.K.955 Posts: 9 🌱

    Hi Josh,

    Thanks, this really helped!
    The issue was indeed with the JSON structure. After correcting that, the request worked as expected.

    Ruud

  • Ruud.K.955
    Ruud.K.955 Posts: 9 🌱

    @Joshua.G.520
    I'm fairly new to working with APIs, but I'm wondering: are you familiar with updating the CanSelfRegister field using a .csv file in combination with the Postman Collection Runner?

  • Joshua.G.520
    Joshua.G.520 Posts: 8 🌱

    @Ruud.K.955 not at all unfortunately. All of my API work is in web apps using HTML and Javascript. I am not sure exactly what you are wanting to do but I do have an API tool that is purpose-built to update classes in bulk via .csv upload, including the CanSelfRegister field. You can find it here: https://drive.google.com/drive/folders/1I1wVCt4Uk_8FlI4kpQW_K2DXGNQyLBjW?usp=drive_link. and look for the Bulk Course Update folder. Maybe someone else has some Postman knowledge they can share :)

  • Ruud.K.955
    Ruud.K.955 Posts: 9 🌱

    @Joshua.G.520 I’d like to perform a bulk update of the Discover field to avoid colleagues having to do this manually for 100 courses.

  • Joshua.G.520
    Joshua.G.520 Posts: 8 🌱

    @Ruud.K.955 Okay that tool I mentioned is purpose-built for that exact scenario. Should work out for you if you try it :)

  • Ruud.K.955
    Ruud.K.955 Posts: 9 🌱

    @Joshua.G.520

    I have it now working with Postman Runner.

    Thanks for your advice!