Availability of latest http request (incl. headers + body) when REST call fails - Mendix Forum

Availability of latest http request (incl. headers + body) when REST call fails

3

It is currently only possible to log and inspect the latest http response when a REST call fails. Often it is desired to also have the associated http request information available as well in order to have the complete picture of a failing REST call.

 

Since REST calls can vary a lot in terms of parameters, query, body (if applicable) etc. it is currently very cumbersome and difficult to build some re-usable logic that enables to 'construct the full http request' (incl. all headers + body etc.) as it is automatically constructed by the REST-call activity by the Mendix runtime.

 

Workable solution would be if the http request would be included in JSON format within the latest http response object when a REST call fails.

asked
4 answers

Hi Richard,

 

Indeed with REST calls using the POST method, this is easier done as well. However using methods without a body (i.e. GET method). this option is not available. Security is indeed something to consider and treated with caution.

Created

I also use it for request bodies. Useful when using POST.

I log the complete URL including parameters with the body.

Errors in headers aren't that common in my opinion as they often contain constants or temporary keys. And I don't want to log the keys of course, which might be a reason this must be treated with caution.

Created

Hi Richard,

 

Thanks for your comment, my idea is however about the REQUEST and not about the response. This would make it possible to do the same things as you described, but with the request JSON in order to log and debug REST-calls that fail.

Created

My best practice is to save the body of a request or response in JSON string and do the mapping in an additional step. This separates the  JSON body from any errors in the mapping to Mendix objects. 

 

In addition I added a step that prettifies the JSON and stores it in a integration log.

 

I understand this only covers the body and not the header. I'm mostly interested in responsecodes and the body.

Created