I'm an experienced developper making a tool to update a bunch of information programatically. I have no problem updating folders but I have a weird issue with the PUT /quizzes/quizID endpoint, see here
https://docs.valence.desire2learn.com/res/quiz.html#put--d2l-api-le-(version)-(orgUnitId)-quizzes-(quizId) I kinda figured that the output of the GET version would be valid in the PUT but according to the documentation it looks like the 2 formats are ever so slightly different.
Now I looked over my request body dozens of time and I cannot for the life of me figure out why the API is returning
{"type":"
http://docs.valence.desire2learn.com/res/apiprop.html#json-binding-error","title":"JSON Binding Error","status":400,"detail":"Provided JSON is invalid or does not match the expected format."}
If anyone can figure out what about my payload is wrong (or if the API has a bug) that's be greatly appreciated.
gist to my payload:
https://gist.github.com/hydroflame/f63a32d513365a6b567ba2addbb34a75 It is worth nothing that I first get the quiz from /quizzes/quizId and then apply the following transformation in order to try and match what the d2l documentation says about the body of a PUT request for updating quizzes:
- delete QuizId (does not appear in the documentation)
- delete AttemptsAllowed (same)
- delete ActivityId (same)
- set NumberOfAttemptsAllowed to old.AttemptsAllowed.NumberOfAttemptsAllowed (the documentation refers to that information differently between the GET response and PUT body)
- set Password to "" (It's null from the GET and the PUT body documentation specifically says the password cannot be null, but also says it cannot be an empty string. null or empty string it doesn't work)
- set NotificationEmail to "" (It's null from the GET and the PUT body documentation says it must be a string)
- set RestrictIPAddressRange to [] (It comes back as an empty array so I figured I'd try something.)
The only information I'm trying to change is the start/due/end date. Everything else is the same.
Can anybody spot my mistake?