less than 1 minute to read
Hook method called after every REST service request.
This method allows you to post-inpect the result from Rest Service calls. It gets passed the @lcResult
reference parameter that contains the JSON response for the request. Because the value is passed by reference you can modify it and the modified value is sent to the Response
.
Non Data Results with `JsonService.IsRawResponse
Be careful with
IsRawResponse
results which don't produce result string JSON output.IsRawResponse
requests directly write output into theResponse
object and you can't intercept these values except by rewriting the response.
o.OnAfterCallMethod(@lcResult)
Parameters
@lcResult
Example
foxpro
************************************************************************
* OnAfterCallMethod - implemented as wwProcess Method
******************************************************
FUNCTION OnAfterCallMethod(@lcResult)
*** Check for error responses and remove the error label from text
IF !EMPTY(lcResult) and ATC(lcResult,["ERROR: ])
lcResult = STRTRAN(lcResult,["Error: ],["],1,1,1)
ENDIF
ENDFUNC
* OnBeforeCallMethod
See also:
Class wwRestProcess© West Wind Technologies, 1996-2024 • Updated: 03/11/16
Comment or report problem with topic