Was this helpful?
AssignJsonRpcResponse2Vars Function
The AssignJsonRpcResponse2Vars procedure parses the response (return value) of a JsonRpcRequest() method invocation and assigns the result/error information to target variables in a given scope.
Note:  This procedure expects that the response is for a single request (not for a batch request).
This function has the following syntax:
integer = AssignJsonRpcResponse2Vars(jsonrpc_response = value,
    [, var_scope = value][, resultvar = value][, byref_assign_rule = value]
    [, byref_param_notfound_handling = value]
    [, result = BYREF(variable)][, errormessage = BYREF(variable)]
    [, errorcode = BYREF(variable)][, errordata = BYREF(variable));
Arguments
Data Type
Description
jsonrpc_response
StringObject
The response of the JsonRpcRequest()
var_scope
Scope
The scope of the 4GL variables used in resultvar and byref_assign_rule parameters
resultvar
Varchar(256)
Specifies the name of the variable that the result (return value of the 4GL procedure called in the JSON-RPC request) is assigned to
byref_assign_rule
Varchar(2000)
Specifies the assignment rule for byref_results. This is a comma-separated string with variable=byrefparam_name pairs.
byref_param_notfound_handling
integer
Defines the handling if a byref parameter name contained in the "byref_assign_rule" parameter (right side of mapping) is not contained in the "byref_params" object within the "jsonrpc_response" parameter string. Possible values include:
0 (default)—Function will return ER_FAIL—errors are written to the errormessage parameter (stringobject)
1—Function will continue to run, warnings are written to the trace window/log file
2—Function will continue to run, ignoring any byref parameters not found
result
JsonValue
The “result” JsonValue within the response (BYREF)
errormessage
StringObject
The “message” within the error object (BYREF)
errorcode
integer
The “code” within the error object (BYREF)
errordata
JsonValue
The “data” within the error object (BYREF)
The function returns ER_OK if successful or ER_FAIL if the response contained an error or processing failed.
Last modified date: 12/20/2023