POST Rest API issue

0
Hello I’m trying to setup a POST Endpoint in my test mendix app, where segment.com can send information to. I’ve created the endpoint, can see swagger, but when i post my json, i get the following error in the console (running locally): java.lang.IllegalArgumentException: The parameter 'body' (String) of microflow MyFirstModule.ReceiveFromSegment does not expect a MyFirstModule.SegmentGroup I’ve created a parameter “body” with type parameter type body, type string, and a import mapping. I’ve selected a microflow where i have defined “body” (string) as the parameter. The error indicates that there seems to be something wrong with the parameter within the microflow. Is there an issue with string as the type? As i have selected an import mapping with the parameter, i’m guess mendix already imports the json at this point. I’m not quite sure if i have to use any “import from json” action or similar within the microflow, as i had to select the import mapping before. Is the microflow used to create the http response only?  Michael
asked
2 answers
0

It sounds like you’ve already run the Import Mapping, so try changing the body parameter in your microflow from a String to a MyFirstModule.SegmentGroup entity. You can then use this entity in your microflow, do what you need to do with the data, and return a suitable response.

Good luck!

answered
0

Hello Robert

The data was indeed already added. I’ve changed the parameter to the object, everything fine now! Thanks a lot, that was fast!

 

Michael

 

answered