API PUT to Course Offering Failing

Dennis.B.2608
Dennis.B.2608 Posts: 3 🔍
edited April 28 in Development

I'm attempting to update a Course Offering to set IsActive to false.

This is the record I'm attempting to update:

{
"Identifier": "745849",
"Name": "Fall 2023 - Pharmacology I (NURS-3104-A-B)",
"Code": "X2388082480198",
"IsActive": true,
"CanSelfRegister": false,
"Description": {
"Text": "",
"Html": ""
},
"Path": "/content/enforced/745849-X2388082480198/",
"StartDate": "2023-08-14T04:00:00.000Z",
"EndDate": "2023-12-12T04:59:59.000Z",
"CourseTemplate": {
"Identifier": "403540",
"Name": "NURS-3104",
"Code": "NURS-3104"
},
"Semester": {
"Identifier": "204867",
"Name": "Fall 2023",
"Code": "202308"
},
"Department": {
"Identifier": "11601",
"Name": "School of Nursing",
"Code": "1604"
}
}

I'm PUTting this object to

https://«our-url»/d2l/api/lp/1.50/courses/745849

{
"Name": "Fall 2023 - Pharmacology I (NURS-3104-A-B)",
"Code": "X2388082480198",
"StartDate": "2023-08-14T04:00:00.000Z",
"EndDate": "2023-12-12T04:59:59.000Z",
"IsActive": false,
"Description": {
"Text": "",
"Html": ""
},
"CanSelfRegister": null
}

I'm receiving a 400 with this body

{
"type": "http://docs.valence.desire2learn.com/res/apiprop.html#invalid-parameters",
"title": "Invalid Parameters",
"status": 400,
"detail": "Request has missing or invalid parameters."
}

I literally copied the request body from the docs from here

https://docs.valence.desire2learn.com/res/course.html#Course.CourseOfferingInfo

and updated the fields.

What is missing?

Answers

  • Hi @Dennis.B.2608

    Thank you for reaching out to the Brightspace Community!. This looks like an issue related to the field "Description" because of the composite block uses the RichTextInput structure type.

    May I please suggest you to modify the Description field in the PUT call as follows to see if this works?

    "Description": { "Content": "", "Type": "Text|Html" }

    Please kindly find below further information regarding this in the following documentation:

    https://docs.valence.desire2learn.com/basic/conventions.html#term-RichTextInput

    Hope this helps.

    Please feel welcome to reach out with more questions!

    Best regards

    Miguel B.

  • Dennis.B.2608
    Dennis.B.2608 Posts: 3 🔍
    edited April 25

    That did the trick, Thank You!

    Out of general curiosity for my edification, why is that object structured differently for the PUT than the POST and GET methods? When I created the course offering using POST, I structured the Description field as outlined in my original question, which worked, and the GET method returns it in that same format. Why the difference?

  • Hi @Dennis.B.2608

    I am glad to know this worked!.

    The RichTextInput is slightly different than RichText. RichTextInput is a specific field type or control, while RichText is the broader concept of text that can be formatted beyond basic plain text. Those composite:RichTextInput datatypes need a specific format.

    Hope this helps.

    Best regards

    Miguel B.