REST API json mapping

This is the json response of a REST API [ { "standardProperties": [ { "propertyName": "DocumentLanguage", "propertyDescription": "Taal document", "propertyValue": "nl" }, { "propertyName": "Period", "propertyDescription": "Periode", "propertyValue": null }, { "propertyName": "ClientName", "propertyDescription": "Naam klant", "propertyValue": "Jacques" }, { "propertyName": "Client", "propertyDescription": "Klant", "propertyValue": "1234" }, { "propertyName": "Contrat", "propertyDescription": "Contract", "propertyValue": "1234" }, { "propertyName": "PersonsName", "propertyDescription": "Persoonsnaam", "propertyValue": "Gerard" }, { "propertyName": "Company", "propertyDescription": "Onderneming", "propertyValue": "0123.456.789" }, { "propertyName": "PartnerName", "propertyDescription": "Naam partner", "propertyValue": "" }, { "propertyName": "NationalNumber", "propertyDescription": "Nationaalnr", "propertyValue": "" }, { "propertyName": "Amount", "propertyDescription": "Bedrag", "propertyValue": null }, { "propertyName": "CreateDate", "propertyDescription": "Creatiedatum", "propertyValue": "2018-03-06" } ], "extraProperties": [ { "propertyName": "Moon", "propertyDescription": "Stand van de maan", "propertyValue": "maan" }, { "propertyName": "Season", "propertyDescription": "Seizoen", "propertyValue": "" }, { "propertyName": "CityOfBirth", "propertyDescription": "Geboorte plaats", "propertyValue": "" } ], "product": "Sociaal Secretariaat", "documentGroup": "Facturen", "documentId": { "value": "[BEGIN] 0 0 0 d=3[END]" }, "read": false, "documentType": { "description": "Jaarsynthese", "documentNumber": "2" }, "documentDescription": "Jaar synthese - 2018" }, { "standardProperties": [ { "propertyName": "NationalNumber", "propertyDescription": "Nationaalnr", "propertyValue": "" }, { "propertyName": "DocumentLanguage", "propertyDescription": "Taal document", "propertyValue": "fr" }, { "propertyName": "Period", "propertyDescription": "Periode", "propertyValue": null }, { "propertyName": "Client", "propertyDescription": "Klant", "propertyValue": "4567" }, { "propertyName": "Contrat", "propertyDescription": "Contract", "propertyValue": "1234" }, { "propertyName": "Company", "propertyDescription": "Onderneming", "propertyValue": "" }, { "propertyName": "PersonsName", "propertyDescription": "Persoonsnaam", "propertyValue": "Jeanne " }, { "propertyName": "ClientName", "propertyDescription": "Naam klant", "propertyValue": "Freddy" }, { "propertyName": "PartnerName", "propertyDescription": "Naam partner", "propertyValue": "Vadderkeu" }, { "propertyName": "Amount", "propertyDescription": "Bedrag", "propertyValue": null }, { "propertyName": "CreateDate", "propertyDescription": "Creatiedatum", "propertyValue": "2018-03-06" } ], "extraProperties": [ { "propertyName": "Moon", "propertyDescription": "Stand van de maan", "propertyValue": "Sikkel" }, { "propertyName": "Season", "propertyDescription": "Seizoen", "propertyValue": "Winter" }, { "propertyName": "CityOfBirth", "propertyDescription": "Geboorte plaats", "propertyValue": "Gent" } ], "product": "Sociaal Secretariaat", "documentGroup": "Facturen", "documentId": { "value": "[BEGIN] 24 1 42 245 07de80014a8d369b000005cc47bb5ced 0 0 0 d=3[END]" }, "read": false, "documentType": { "description": "Jaarsynthese", "documentNumber": "2" }, "documentDescription": "Jaar synthese - 2018" } ] This json mapping is automatically mapped to this domain model (in the import mapping)   If I want this kind of overview : I convert the model to this entity : in the microflow after the REST action which transforms the Documents and returns a list of RecentDocument entities :   and use this microflow to fill for instance a datagrid :   Is this the best way to do?
2 answers

I'm not sure of the use case, but calling the rest service in a data source microflow will give the a user a delay before they see the data. You could improve user experience by calling the rest service and doing the transformation before the user gets to the page. 


Does the data change often? Or is there a parameter you are passing to make the rest service call specific to a user? If its a static list, you could improve performance by persisting this data, that way a rest service isnt called every time a user comes to this page. And then use scheduled events to update the data periodically.


Is there anything specific you are worried about?


Another way to improve performance would to change the method in your import mapping from "create object" to "call a microflow" that way you can do the transformation in the mapping. 


So, I have a few recommendations for that microflow to maybe speed things up.

-If able I would recommend not looping within a loop. If you absolutely need to I would recommend extracting it to a submicroflow.


-Also, I would limit the amount of retrieves you perform within the loop. If you only need to retrieve a set of data once I would just do it before the loop. Doing multiple retrieves on the same data within a loop will reduce performance.