Using RestServices to Publish a POST Service.

0
This was originally a question as I was getting an error. After having downloaded the RestServices module, go to project settings -> runtime and change After startup microflow to a new microflow. Add StartPublishServices to the microflow. Add the service overview to your administration and compile. Create two modules. One normal one and one for REST. Create a domain model for both . -- Create a OnUpdate POST Service Microflow.   Run Mendix, add a new Published Service and enter the name of your microflow to run for your POST service. Use postman to test the publishing POST Service.   [P.S.] If you happen to stumble upon this type of error: Caused by: java.lang.IllegalArgumentException: requirement failed: Reference 'MyRestModule.Image' only accepts ids of type 'MyRestModule.Request_Image' (Id '[MendixIdentifier:: id=12947848928690788 objectType=MyRestModule.Request_Transaction entityID=46]' is not allowed). Then do the following: Turn the association into an */* one. Delete the assocation. Recreate the 1/1 association with the arrow in opposite direction.
asked
2 answers
2

To my knowledge, the On Update microflow should have 1 parameter with the object that is going to be updated (the Source Entity), and 1 non-persistent object which is populated based on the incoming JSON message. See also documentation snippet below that was taken from https://github.com/mendix/RestServices

The message indicating that the 2nd parameter should be 'persistable' seems like a bug to me and should read 'non-persistent' or 'transient' instead

 

On Update Microflow(optional)

Microflow that processes incoming changes.

Should have two parameters; one of same type as the source entity, and one which is a transient entity. The transient object will be constructed with JSON data in the incoming request. This transient object should be processed by the microflow and update the source object as desired. Use the ThrowWebserviceException method of Community Commons to signal any exceptions to the consumer.

answered
0

Could you elaborate this. How is the mapping, is it the consuming of the publishing side of the service? Are you only logging a message? Where is the service call?

answered