How to create a file topic using the API

Arald.d.320
Arald.d.320 Posts: 15 🌱
edited July 4 in Development

Because we want to create part of our course content using information from the application where we develop our modules I am trying to figure out how to create a file topic. I do this using Postman but sofar all I get is a 400 error (bad request). Updating an existing file topic by uploading a new file (PUT) works fine but I can't get a http 200 when I try to create a file topic from scratch. I provide a JSON datablock for a topic of the TopicType 3 and attach the file to the request (like with the update which works fine). When I look at the body data of my request in Postman and compare it with the documentation for simple file uploads provided at: https://docs.valence.desire2learn.com/basic/fileupload.html#simple-uploads

I see one difference and that is at in the documentation the Content-Disposition: form-data name="" part is missing in the documentation. I can't get Postman to not add this part. Can this be the couse og mij http 400 error?

In the attached picture you can see my request and the response.

The request I try to use is:
POST /d2l/api/le/(version)/(orgUnitId)/content/modules/(moduleId)/structure/

Tagged:

Answers

  • Julie.L.787
    Julie.L.787 Posts: 323 ⏸️ Inactive

    Hi @Arald.d.320,

    Thanks for connecting with the Brightspace Community. I'm connecting you with our Learn Postman with Paul course in case it's a helpful resource for troubleshooting. I would also recommend creating a support ticket so that our IT folks can take a closer look at what might be causing this error to occur.