How to send data through a POST to an API?

0
Hello Mendix community.   I have a problem. I want to send through a POST service data from my Mendix application to an API that connects to a database. Inside my JSON I have the following structure:     That is to say, the data I want to send is the data of an Activity entity and associated with it has a serial entity, so I need to send an activity and within it many serials. The ExportMapping was as follows:     I have tested Postman and it works, but I don't know how to send this information from Mendix. I have done it through a microflow that brings me the Activity data and then through a Loop I fill in the serial entity data, but when it reaches the Call REST POST I get an error.   I hope you can help me understand how to send data through a REST POST call with a JSON that contains a list within it.   Thank you, your help will be very valuable.
asked
2 answers
2

Hi Sergio,

You can find out the issue if you put your Log to trace for the REST consume.

The option is in the console> Advanced> Set Log Leves> Rest Consume> Trace.

 

This way, you will be able to know the exact reason for the error,

Also can you pls attach the log for the error, that you are getting, it will help us to understand what exactly is wrong with the Rest of call.

 

Things you can check:

-> are you passing the correct headers?

-> Is the authentication correct?

-> Is the payload correct?

 

Let me know, if you have any issues,

Hope it helps!

answered
0

On a highlevel from the screenshot, the attribute name in SeriaNumberItem seems to be wrong. As per you JSON it is supposed to be "serial" while you have "Serial" in the domain model. Check that.

that could be the issue

answered