Transferring data from one app to another

0
Hi, We have one app called “TestExportData” and another called “TestImportData”. What we are trying to do is export the entity “RandomData” using a POST REST API on the TestExportData app and then import to the “TestImportData” app. We are having issues doing this however. Looking at the logs of “TestImportData” it seems that the app is receiving this data however it doesn’t seem to be creating the object within the app. Above is the log message showing what we think is the “TestImportData” app receiving the data from the “TestExportData” app. What we are trying to figure out is how to make the “TestImportData” app recognise that it is receiving data from the REST POST API and then trigger a microflow that creates objects based off the list of data that it is receiving. I’ve looked at the import mapping section on Mendix’s knowledge guide (“https://docs.mendix.com/refguide/import-mapping-action”) but this doesn’t really help in regards to transferring data from one app to another. Any help on this would be gratefully appreciated, thank you.    
asked
2 answers
2

Hi Nathan, 

 

I think this might help:

 

https://docs.mendix.com/refguide8/published-web-services

or:

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

answered
0

The log shows a PUT-call. Meaning your importapp attempts to place an object on your exportapp. Probably not your idea.

To get started easily, in your exportapp rightclick on an entity, select ‘Expose as REST service’, click Select and create a new Service ‘MyService’, add your entity, at ‘key attribute’ select an attribute that is unique. Check all operations and click ‘OK’. Solve the Access rights and run your app. There you go, your service is fully published.

Check the result on <yourappsurl>/rest-doc/. Click ‘GET’,  ‘Try it’ and ‘Execute’ and look at the curl. Copy the location, something like:

http://localhost:8081/rest/myservice/v1/YourEntity

 in your importapp, in the REST-call activity in your calling microflow, at this to ‘Location’. Save, Run, trigger your microflow and the rest call will receive your data.

To map the received data to your importapp’s domain, copy-paste the importmapping that got automatically created from your exportapp to your importapp and in your rest-call activity on the last tab ‘Response’ select ‘use import mapping’ and select it. Save, run again, trigger your microflow, now the data is imported and stored in your importapp.

answered