Why do I get error code 400 when I Post Topic to D2L?
request body (as described here):
{"Title":"123",
"ShortTitle":"",
"Type":1,
"TopicType":3,
"Url":"/d2l/common/dialogs/quickLink/quickLink.d2l?ou=10593&type=lti&rcode=04E1284B-7166-4938-B8A7-6F359D1AA5FC-195613&srcou=10593",
"StartDate":null,
"EndDate":null,
"DueDate":null,
"IsHidden":false,
"IsLocked":false,
"OpenAsExternalResource":false,
"Description":{"Text":"","Html":""},
"MajorUpdate":null,
"MajorUpdateText":"",
"ResetCompletionTracking":null,
"Duration":null}
response:
{"type":"http://docs.valence.desire2learn.com/res/apiprop.html#invalid-parameters","title":"Invalid Parameters","status":400,"detail":"Request has missing or invalid parameters."}
The module id 366347 exists in course content. I also tried to change Description value to null, but have the same result.
Note that GET request to "https://partners.brightspace.com/d2l/api/le/1.12/10593/content/modules/366347/structure/?x_a=......................." successfully returns data with status 200 OK . Also there were no problems with POST requests to other API paths.
Thank you!
Answers
-
@Pavel Mazhnik
Can you please try with
"Description": {"Text":"", "Type":"HTML"},
instead of
"Description":{"Text":"","Html":""},
and let me know if it worked?
Thank you.
Sid
Senior Product Support Analyst
-
@Sidharth Sunder
I did it, but unfortunately the same error occurred.
-
@Pavel Mazhnik I apologize, I made a mistake in my previous post.
Can you please try with:
"Description": {"Content":"", "Type":"HTML"},
and let me know if it worked?
Thank you.
Sid
Senior Product Support Analyst
-
@Sidharth Sunder It didn't help
-
I finally found a solution. In my case, there was an error with the header "Content-Type".
For some strange reason only in this request it wasn't "application/json". Explicit header definition solved this problem.
Thank you for your help!