Ability to trap response code for REST calls - Mendix Forum

Ability to trap response code for REST calls

0

The native REST implementation works great in most cases, however in some cases the external system responds with a specific response code to indicate a specific type of error.

For example, the API could return a 404 response code in case data is not found, and a 403 response when a daily rate limit was exceeded. Depending on the result I would like to branch to a separate flow (for example, displaying a specific information message to the user or postponing a request to the next day) .

 

This could (for example) be solved by adding a $latestRestError/httpresponsecode variable or change the $latestSoapFault variable into something more generic 

 

asked
1 answers

This is possible in Mendix 7.

 

From the releasenotes:

 

Access to HTTP response for REST calls

It is now possible to access the latest HTTP response and the HTTP headers through the $latestHttpResponse variable. You can also access the message body of the HTTP response via this variable in the error flow (for status codes other than 2XX).

In addition, it is now possible to select HTTP response as the return type of the REST call action.

 

Created