CsvServices module

6
I've uploaded a module i use frequently for test and demo projects to GitHub: CsvServices It's basically a Excel Exporter/Importer meets Rest Services, as it creates a Rest endpoint for every entity in your project that support csv content-type exclusively. I use it for two main reasons: Ability to automatically initialize a mendix database by loading all data from csv files using a script. No more manual actions to initialize data. External reporting. I use RStudio quite a bit for reporting. Using the csv endpoints i can pull data out of Mendix into Rstudio directly for realtime reporting. No more manual steps to export data in excel format. This hasn't been tested for production apps or with large datasets, so take care when using it. More documentation is available on github: CsvServices readme
asked
3 answers
1

Blogpost with a bit more info on this module: Quickly loading your data into a Mendix App using the CSV Service module

answered
0

Hello,

I am having an issue with CSVService module.  I get "Could not find web service Orders" from my Mendix Console after I issue the Curl command.

I basically follow the written direction from CSVService github CsvServices/docs/blog-csv-services.md

1.  Downloaded CSVService from Mendix app store

2.  Created a sample Mendix app (I have Mendix Modeler version 6.8.1)

3.   Created a new module and named it "Orders"

4.   Under Orders, I have an entity called ProductLabels which has 2 attributes (LabelId as Long and Label as String)

5.   I have a sample csv file called label-data.csv that has 3 lines for sample data

Curl command as follow:

curl -v -X POST -H "Content-Type: text/csv" http://MxAdmin:1@localhost:8080/ws-doc/Orders/ProductLabels --data-binary "@labels-data.csv"

 

I get the following result back with no errors (pic below) but I get "Could not find web service Orders" in my Mendix console and my SQLServer table ProductLabels is empty.  Why is it looking for a web service called "Orders"?

Any help would be greatly appreciated.

 

answered
0

Hi,

I am trying to implement the CsvServices module in my project.

However I run into some configuration issues.

The documentation says:

The CsvServices module creates an API like this for every entity in your project: http://<servername>:<port>/ws-doc/<module_name>/<entity_name>. The path ws-doc is used to enable this on sandboxes.

 

However when I look in my workspace I don't see a ws-doc subfolder.

 

When I run the following curl command:

curl -v -X POST -H "Content-Type: text/csv" http://MxAdmin:1@localhost:8080/ws-doc/Module/Entity --data-bi
nary "@test.csv"

 

I get the following error:

Invoke-WebRequest : Cannot bind parameter 'Headers'. Cannot convert the "Content-Type: text/csv" value of type "System.
String" to type "System.Collections.IDictionary".
At line:1 char:20
+ curl -v -X POST -H "Content-Type: text/csv" http://MxAdmin:1@localhos ...
+                    ~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Invoke-WebRequest], ParameterBindingException
    + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

 

Did I miss any prerequisite, besides adding the MF_StartCsvServices microflow to the AfterStartup microflow?

 

Regards,

Elco

answered