In this blog, we’ll focus on implementing POST APIs in Mendix. Unlike GET APIs, which retrieve data without modifying the server, POST APIs allow you to send structured data in the request body to perform various actions. These actions can include creating new records, retrieving filtered data based on input parameters, or processing complex business logic.
First create the Mendix application in any version. Here, I am using 9.24.5
-> Open Mendix studio pro
-> Create new app
-> Select Blank web app
Go to MX Studio Pro and create an entity & give any name like “Book” & add your data.

FOR RETRIEVAL:-
Go to MX Studio Pro create a folder POSTAPI -> right click on it-> click on other->Published Rest Service & give the name PRS_POSTAPI.

Now go to PRS_POSTAPI-> add resources & give any name(PostApi).

Go to POSTAPI folder -> right click-> other->Click on Message Definition & give any name(MD_Book).

Open MD_Book(Message Definition) -> Click Add->Select your Book Entity & Check All attribute and click ok.

Go to again MD_Book(Message Definition) -> Select Book -> Click on Generate mappin to generate the export mapping and select only export mapping for this tutorial & click ok.

You can see your export mapping.

Now go to PRS_POSTAPI-> Add operations for ‘PostApi’-> Select POST Method & in the microflow create a new microflow(GetBookData).

Now open your GetBookData microflow
- Take a retrieve activity inside this microflow -> retrieve data from database -> select your Book entity.

2. Now return the BookList

Go to again PRS_POSTAPI -> Open your POST Operation -> Select your Export mapping(EXP_Book) & Click OK.

Now Run the application & test it.
Go to your PRS_POSTAPI & Click on the link and Execute the API.


FOR DATA ADDING:-
Go to PRS_POSTAPI-> Add New operations for ‘PostApi’-> Select POST Method & in the microflow create a new microflow(PRS_AddBookData) and in the Operation path give “addbooks”.

Open your PRS_AddBookData microflow-> take a parameter of Book entity->in the Data type select Object.

Now go to again PRS_POSTAPI -> Open POST/PostApi/addbooks-> Add one body parameter(addValue)-> Type(Object)->Entity(Book)->Microflow parameter(Book) and create a new import mapping(IMP_Book)& select it.

Go to IMP_Book(Import mapping) ->Click on Select elements -> Select Message definition & select Book from MD_Book & check all the attributes.


Double click on the Book(inside IMP_Book) & follow the image.

Now run the application & test it.

{
"BookName": "JavaScript",
"Price": 2000
}

You can also check it by retrieval method -> just hit the retrieval API & check the value.

Conclusion:
I hope this article has helped you understand How to Implement POST API in Mendix.
Thanks for reading this! See you in the next blog post.