REST API mapping

0
Our applications calls a REST API which returns a generic model. Is it a good idea that in the microflow, where the REST action is executed, we map the data from the first model to another model with non-persistable entities. That last model only contains the data needed to show in a datagrid or listview. Or does it create memory overhead when data is kept twice in memory but in different entities?
asked
2 answers
2

Hi Olivier,

Here is a simple example of a string variable in the API, where it's converted to a boolean.
https://modelshare.mendix.com/models/f4a55f47-a3bc-406a-b047-aba236bc22c1/res-t-format-mandatory

 

Another example where a date string is converted to an actual datetime attribute:
https://modelshare.mendix.com/models/9e6f04f5-312b-4e0e-9ed0-afe894932390/rest-format-end-date

Let me know if you have any other questions!

answered
1

Depending on how often the rest service is called, it shouldn't be too big of an issue. Once you are done with a non-persistent entity the garbage collection will remove it from memory. 

If you want to improve your performance you can set the import mapping method to call a microflow instead of creating an object. That way you can import the json to your second data structure.

Here is some documentation that talks about it

https://docs.mendix.com/refguide/import-mappings

 

Edit: If you double click the grey entity in your mapping, it will open up the properties and this is where you can define this method. 

answered