How to create POST and PUT methods in mendix ?

0
I want to create POST and PUT methods (using API) in my application. I searched about this and I cannot find a complete guide for this. 
asked
2 answers
1

Hi Kosala Dayarathne

 

If your application is sending data to an external service you would need to make sure that external service supports a PUT endpoint for your data. They should have a spec for the data they are expecting. If this is JSON you could create a JSON structure in your Mendix app and build an Export Mapping based on this. You would then use this in your Call REST action in a Microflow to map the data from an entity into the correct structure to PUT to the external service. Make sure you select PUT as the HTTP Method for the Call REST action. Depending on the returned data from this call you may also need an Import Mapping to handle the response from the external.

 

Follow below URL: 

 

https://docs.mendix.com/refguide/call-rest-action/

 

I Hope it will Help You !

 

Thank You ,

K. Ravi Kumar.

answered
1

Hi Kosala Dayarathne,

  1. Create a Microflow:

    • In Mendix, you can use a microflow to call the ‘Call REST service’ activity.
    • In the microflow, select the method you want to perform on the endpoint (e.g., POST or PUT).
    • For POST and PUT, you’ll need to include a request body with the necessary data.
  2. Configure the REST Service:

    • Expose the REST APIs for your existing functions within your Mendix app.
    • You can configure and expose REST services by following the guidelines provided in the Mendix documentation.
    • Ensure that you generate descriptive API specifications with Swagger documentation.
  3. Test and Implement:

    • Test the REST services you’ve created to ensure they work as expected.
    • Implement the necessary functionality in your Mendix application to handle the POST and PUT requests.
answered