Example of OnAfterResponse (Advanced) .Net

Example of OnAfterResponse (Advanced) .Net

Where can i find a example of a OnAfterResponse Advanced for .Net; I want to build a action to retrieve the ResponseText by using the Extensibility API's GetResponseBodyAsText.

This can't be done by de default OnAfterResponse because a exception is trown when the response has a HTTP error status.
Hello Mathias,

You have opened a support case with this and I have given you an example of a working module in this scenario.

I believe this solved the issue you were having, correct?

From my example, everything was working as expected, and the response text was being correctly filled even when an error code was returned from the server.

Best regards,
Ricardo Silva
Hello Ricardo,

Thank you for this sample, the Extensible API did work, but it also worked with a normal OnAfterResponse and the Response.ResponseText. I implemented, the OnAfterResponse this way, the CustomizedResponse.ResponseText is set to “”, so there will be no parsing error of the ResponseText.

Screenshot of the OnAfterResponse implementation

*removed reply since it was just a heads up saying the same that Mattias replied at the same time*
... and clear the CustomizedResponse.ResponseText to avoid Parsing the error text.

Failed to parse response of the method 'REST_MAIN_GetReporting' of the 'TimeSeries' REST API:
Parsing '': Unexpected character encountered while parsing value: e. Path '', line 0, position 0