Consuming REST Service and Passing Body Parameters

0
Hi, I have a ready REST Web API Service which i need to consume in Mendix. How can I send body parameters and authentication token using Mendix Microflow? I have gone through the Mendix document and Video but i did not find it. Thanks in advance.
asked
2 answers
1

Have a look at https://docs.mendix.com/howto/integration/consume-a-rest-service , it has examples for Rest services consumed.

You can add your body in the request section or the "Call Rest Service" action, your authentication will be under headers.

Hope this helps

answered
1

Hi Nikhil,

  I assume the REST service you would like to consume requires a POST, in which case you can select 'POST' from the HTTP Method dropdown on the 'General' tab.  You can then go to the 'Request' tab and create the body of the REST call.  The fastest way to do this is using the 'Custom Request Template' option where you build your JSON directly in that window and replace parameters as needed.  The best way to do it is using an Export Mapping to map Mendix objects directly to the REST call.

  Your authentication can be done in the 'Headers' tab.  If the service requires Basic Auth, you can use the check box for 'Use HTTP Authentication' and enter the username and password into the boxes provided.  If you need to pass something more complex like a Bearer token, use the 'New' button under the Custom HTTP Headers' to enter the correct Key and Value pairs.  One thing to note is many REST calls require you to pass along the header: content-type: application/json, so if you get an error around invalid content type that is the reason.

  Best of luck!

answered