In Part 2 of the Consumed API Series, you’ll learn how to consume a POST API in Mendix to send data to an external system. This step-by-step guide walks you through setting up the request body, configuring headers, handling responses, and mapping data using microflows. Ideal for developers looking to integrate external services into their Mendix applications.
First create the Mendix application in any version. Here, I am using 9.24.34
-> Open Mendix studio pro
-> Create new app
-> Select Blank web app
Dependencies:-
FOR RETRIEVAL:-
You can find the published API endpoint URL below for data retrieval. For a better understanding of how this API was created, please refer to the previous article linked above.
http://localhost:8082/rest/prspostapi/v1/PostApi
Copy the endpoint URL and use Postman to validate the JSON response structure.

[
{
"BookName": "string",
"Price": 0
}
]
Go to MX Studio MyFirstModule(YourModuleName) -> right click on it-> click on other->JSON_Structue -> give the name JSON_Book.

Open JSON_Book -> Copy upper JSON & paste it here.

Go to MyFirstModule -> right click on it-> click on other -> Import_Mapping -> give the name IMP_Book.

Open IMP_Book -> Select elements & select priviously created JSON_Book, Check all & click ok.

After clicking Ok , Click to Map automatically.

Now Create a microflow name it DS_GetBookDataByPost.
Go to DS_GetBookDataByPost
- Take a Call REST Service activity -> Under General tab pass your endpoint URL & select HTTP method(POST).

2. Go to Response tab -> Select your previously created IMP_Book import mapping & click yes Store in variable.

3. Take a retrieve activity -> Select retrieve by association & select the $Root/JsonObject_Root.

4. Lastly, return the $JsonObjectList.

Go to Home_Web page -> Take a datagrid, Under DataSource tab select DS_GetBookDataByPost microflow as a dataSource.

Now run the application & test it.
Important:
Since you’re using two different Mendix applications — one to publish the API and another to consume it — make sure the application where the API is published on localhost is running before making any API calls from the other app. If the publishing app isn’t running, the API request will fail.

FOR DATA ADDING:-
endpoint URL :- http://localhost:8082/rest/prspostapi/v1/PostApi/addbooks
JSON Structure :- {
"BookName": "string",
"Price": 0
}
headers :-
Key : Content-Type
Value : 'application/json'
First Go to MX Studio Pro & Create a non persistable entity to adding Book data dynamically with same attributes.

Go to MyFirstModule -> right click on it-> click on other->
JSON_Structue -> give the name JSON_AddBook.

Open JSON_AddBook -> Copy upper JSON & paste it here.

Go to MyFirstModule -> right click on it-> click on other -> Export_Mapping -> give the name EXP_Book.

Open EXP_Book -> Select elements & select priviously created JSON_AddBook, Check all & click ok.

Double click on Root entity & map with AddBook entity.


Now Create a microflow name it ACT_AddBook.
Go to ACT_AddBook
- Take a create object activity -> Select AddBook entity & add your value.
I am adding static value you can add dynamic according to your need.

2. Take a Call REST Service activity -> Under General tab pass your endpoint URL & select HTTP method(POST).

3. Go to HTTP Headers tab & Add above header.

4. Go to Request tab -> Select Export mapping for the entire request & map all the things.

5. Lastly, Take a Call microflow button on home page & select this microflow.

Now run the application & test it.

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