Can a published REST service be used to automatically put .csv files into the app from outside the app?

0
Hi,    Does anybody have experience with Published REST Services in combination with a PUT or POST ? I am trying to find out if it's possible to use a Published REST Service to have a .csv file pushed into the Mendix app from outside the application and have the data in that .csv file automatically processed in the Mendix app.   In the Mendix documentation I only find examples related to a GET, however I can't find any detailed documentation or examples about PUT and/or POST.   I already tried to use the appstore module CsvServices, however I didn't get it working. Any other suggestions are welcome.   P.S. I don't want to import the .csv file into the Mendix app, but I want to let the other application send the .csv file into the Mendix app.   Thanks,  Elco
asked
2 answers
1

Yes, you can do that, like this:

1 - Create a POST operation in a published REST service

2 - Use a microflow that takes a System.HttpRequest parameter

The Content attribute will be filled with the CSV file contents when someone POSTs a CSV file to that operation.

answered
0

Hi Elco:

Definitely. A csv file and images and so on could be decoded to a string pasted in your request object for your service. Than you can decode it and make it again a CSV file in your published service in Mendix.

A possible application of receiving a csv file in Mendix could be like (if the file renaming and opening to CSV gives issues, you can use similar set up as in the CSV exporter module from app store) :

1 - Publish a PUT REST service

2 - Convert your CSV file to base64 data and put it in your request object  and send the request object to the REST service

3 - Process the received request in Mendix by decoding the base64 data to a file and change the name to .csv and store it

 

answered