I have a basic Valence App build for Desire2Learn and now I'm trying to POST data and I either get a 400 or 404 error.
If I make a GET request to /d2l/api/le/(D2LVERSION: version)/(D2LID: orgUnitId)/content/root/, with the correct orgUnitId, I can see all of the content for a course. However, when I POST a ContentObjectData of type Module, it returns a 400. The docs have nothing listed for a 400 error for that particular request, but I'm assuming that I messed up the ContentObjectData. I've tried multiple times, but it always results in a 400. The JSON block looks like this: { "Title": "API Test", "ShortTitle": "", "Type": 0, "ModuleStartDate": null, "ModuleEndDate": null, "IsLocked": false, "IsHidden": true }
If I make a GET request to /d2l/api/le/(D2LVERSION: version)/(D2LID: orgUnitId)/content/modules/(D2LID: moduleId)/structure/, with the correct orgUnitId and moduleId, I can see the module's content. When I POST a ContentObjectData of type Topic, it returns a 404. I'm doing this in Python, which there is no sample SDK code given, so I converted the PHP one.
I've been using another JSON block with a key 'Url' and then the respective value. Here's the fully encoded multipart body I've been trying to POST:
--redacted.132.0.68062.1336325296.611.1
Content-Disposition: form-data; name="ContentObjectData"
Content-Type: application/json
{"StartDate": null, "IsLocked": false, "TopicType": 3, "ShortTitle":
"", "Title": "API Test", "Url": "http://redacted.edu",
"EndDate": null, "IsHidden": true, "Type": 1}
--redacted.132.0.68062.1336325296.611.1
Content-Type: application/json
{"Url": "http://redacted.edu"}
--redacted.132.0.68062.1336325296.611.1--
Why would the same URI for GET and POST result in a 404 just for POST? It doesn't look like the structure is any different between the two calls in the docs. I tried this call as a normal POST request and as the multipart, but both result in a 404. I've tried both of these calls using 3 different users, one which has full admin privileges.