Hi Pascal,
In Mendix 9 you have a Call Rest action for consumption
https://docs.mendix.com/refguide/call-rest-action/#latesthttpresponse
https://docs.mendix.com/refguide/import-mapping-action/
“If HTTP response status code is not successful (for example, [4xx]
or [5xx]
), the flow will continue in an error handler.
You should always add an error handler for a call REST service action.”
You will get a error, however, if you try to directly apply the import map with a response without content..
So.. you can just store the “Http Response” into a Variable and implement your validations for anything response code < 400. And then apply a Import With Mapping with appropriate map (erro response or data response)
Best regards
Everything other than 20x http code will result in an exception. You have to handle other HTTP codes by yourself in the errorhandling
easy testing with this website: https://httpstat.us/
In deed, no error with 201,202,204,299.
In vcode I use
GET https://httpstat.us/204 HTTP/1.1
Content-Type: application/json
accept: application/json
204 gives no json back!