Publish rest service | Inputs & Best practice

0
Hi All, Need input for publishing as rest service. By right-clicking the entity and choosing the option expose as rest service I have created all the operations (GET, POST PATCH...)and noticed outputs are generated in XML. I have gone through the document and using export mapping outputs are generated in JSON for the GET method but for the POST method, I didn't find any documentation. Below is my requirement, .I need to create a record using the POST method and the request should be in JSON..please share the steps on how we can do that and what is the best practice
asked
1 answers
1

I don't know why, but Mendix defaults to XML in this case. You have to manually set the Content-Type of your REST responses to JSON via a httpHeader. To do this, create a httpHeader object in the published POST method microflow and couple it to the httpResponse:

image.png

answered