REST Responses

1
Hi All,   I have a platform that contains several Published REST Services. To communicate the right status of a request back to the client I use the REST Responses Module from the Marketplace, which works brilliantly. However when preparing the upgrade from version 9.18.7 to 9.24.5 or 10.1.1 I noticed that this module is no longer supported and it won't compile in a newer version. Does anyone know if there is an alternative or how I can create a HTTPResponse myself? Just creating a HTTPResponse object in a Microflow does not seem to cut it.   I hope you can help me!   Thank you in advance and have a nice day!   Best, Martijn
asked
3 answers
0

You can have both httpRequest and httpResponse objects as (additional) input parameters to your published microflow. Mendix will use them automatically, you won’t have to map them or anything. Then in the microflow just set your httpResponse object as you wish. No need to return it though, just set it. Note that Mendix seems to have deprecated setting the ReasonPhrase explicitly, it will overwrite it and do that automatically based on the StatusCode, which makes sense. I don’t remember precisely when that’s going to happen though, probably Mx10.

answered
0

Hi Martin,

 

Thank you for your reply and your help. I made a small setup in Mx10 to see if I understood your answer.

 

 

However in this setup the microflow still returns a httpresponse ‘200’ / ‘Succesfull operation’, instead of the httpresonse ‘401’ /  'Authorization failed: connection rejected' I created. What would be your advise to change this microflow to make it return the right httpresponse?

 

Thank you again for your help and have a nice day!

answered
0

Hi All,

 

Inspired by the response of Martin I did another test today. It seems that you don’t need to create a new HttpResponse object like I did, but just change the existing one. In hindsight this seems logical. Now the REST Service returns the right status, so case closed!

answered