Qore JSON Module  1.1
 All Classes Namespaces Functions Groups
JSON-RPC Functions

Functions

string Qore::makeFormattedJSONRPC11ErrorString (softint code, string error, any id, any error_msg)
 Creates a JSON-RPC 1.1 error response string from the parameters passed, formatted with line breaks for easier readability.
string Qore::makeFormattedJSONRPCErrorString (any version, any id, any error_msg)
 Creates a generic JSON-RPC error response string from the parameters passed, formatted with line breaks for easier readability.
string Qore::makeFormattedJSONRPCRequestString (string method_name, any version, any id, any request_msg)
 Creates a JSON-RPC request string from the parameters passed, formatted with line breaks for easier readability.
string Qore::makeFormattedJSONRPCResponseString (any version, any id, any response_msg)
 Creates a JSON-RPC response string from the parameters passed, formatted with line breaks for easier readability.
string Qore::makeJSONRPC11ErrorString (softint code, string error, any id, any error_msg)
 Creates a JSON-RPC 1.1 error response string from the parameters passed, without any line breaks.
string Qore::makeJSONRPCErrorString (any version, any id, any error_msg)
 Creates a generic JSON-RPC error response string from the parameters passed, without any line breaks.
string Qore::makeJSONRPCRequestString (string method_name, any version, any id, any request_msg)
 Creates a JSON-RPC request string from the parameters passed, without any line breaks.
string Qore::makeJSONRPCResponseString (any version, any id, any response_msg)
 Creates a JSON-RPC response string from the parameters passed, without any line breaks.

Detailed Description


Function Documentation

string Qore::makeFormattedJSONRPC11ErrorString ( softint  code,
string  error,
any  id,
any  error_msg 
)

Creates a JSON-RPC 1.1 error response string from the parameters passed, formatted with line breaks for easier readability.

Code Flags:
RET_VALUE_ONLY
Parameters:
codethe error code to return
errora string error message
idthe ID of the call
error_msgthe parameters for the error response message/message payload
Returns:
a JSON string in UTF-8 encoding representing the JSON-RPC 1.1 error response, formatted with line breaks for easier readability
Exceptions:
MAKE-JSONRPC11-ERROR-STRING-ERRORthe error code is not between 100-999 or empty error message string
JSON-SERIALIZATION-ERRORcannot serialize value passed (ex: binary, object)
Example:
my string $json = makeFormattedJSONRPC11ErrorString(200, $msg, $id, $error);
See also:
string Qore::makeFormattedJSONRPCErrorString ( any  version,
any  id,
any  error_msg 
)

Creates a generic JSON-RPC error response string from the parameters passed, formatted with line breaks for easier readability.

Code Flags:
RET_VALUE_ONLY
Parameters:
versionthe JSON-RPC version to include in the call
idthe ID of the call
error_msgthe parameters for the error response message/message payload
Returns:
a JSON string in UTF-8 encoding representing the JSON-RPC error response, formatted with line breaks for easier readability
Exceptions:
JSON-SERIALIZATION-ERRORcannot serialize value passed (ex: binary, object)
Example:
my string $json = makeFormattedJSONRPCErrorString("1.0", $id, $error);
See also:
string Qore::makeFormattedJSONRPCRequestString ( string  method_name,
any  version,
any  id,
any  request_msg 
)

Creates a JSON-RPC request string from the parameters passed, formatted with line breaks for easier readability.

To follow JSON-RPC specifications, the generated string will always be in UTF-8 encoding

Code Flags:
RET_VALUE_ONLY
Parameters:
method_namethe name of the JSON-RPC method to call
versionthe JSON-RPC version to include in the call
idthe ID of the call
request_msgthe parameters for the message/message payload
Returns:
a JSON string in UTF-8 encoding representing the JSON-RPC request, formatted with line breaks for easier readability
Exceptions:
JSON-SERIALIZATION-ERRORcannot serialize value passed (ex: binary, object)
Example:
my string $json = makeFormattedJSONRPCRequestString("omq.system.help", "1.0", $id, $msg);
See also:
string Qore::makeFormattedJSONRPCResponseString ( any  version,
any  id,
any  response_msg 
)

Creates a JSON-RPC response string from the parameters passed, formatted with line breaks for easier readability.

Code Flags:
RET_VALUE_ONLY
Parameters:
versionthe JSON-RPC version to include in the call
idthe ID of the call
response_msgthe parameters for the message/message payload
Returns:
a JSON string in UTF-8 encoding representing the JSON-RPC response, formatted with line breaks for easier readability
Exceptions:
JSON-SERIALIZATION-ERRORcannot serialize value passed (ex: binary, object)
Example:
my string $json = makeFormattedJSONRPCResponseString("1.0", $id, $msg);
See also:
string Qore::makeJSONRPC11ErrorString ( softint  code,
string  error,
any  id,
any  error_msg 
)

Creates a JSON-RPC 1.1 error response string from the parameters passed, without any line breaks.

Code Flags:
RET_VALUE_ONLY
Parameters:
codethe error code to return
errora string error message
idthe ID of the call
error_msgthe parameters for the error response message/message payload
Returns:
a JSON string in UTF-8 encoding representing the JSON-RPC 1.1 error response, without any line breaks
Exceptions:
MAKE-JSONRPC11-ERROR-STRING-ERRORthe error code is not between 100-999 or empty error message string
JSON-SERIALIZATION-ERRORcannot serialize value passed (ex: binary, object)
Example:
my string $json = makeJSONRPC11ErrorString(200, $msg, $id, $error);
See also:
string Qore::makeJSONRPCErrorString ( any  version,
any  id,
any  error_msg 
)

Creates a generic JSON-RPC error response string from the parameters passed, without any line breaks.

Code Flags:
RET_VALUE_ONLY
Parameters:
versionthe JSON-RPC version to include in the call
idthe ID of the call
error_msgthe parameters for the error response message/message payload
Returns:
a JSON string in UTF-8 encoding representing the JSON-RPC error response, without any line breaks
Exceptions:
JSON-SERIALIZATION-ERRORcannot serialize value passed (ex: binary, object)
Example:
my string $json = makeJSONRPCErrorString("1.0", $id, $error);
See also:
string Qore::makeJSONRPCRequestString ( string  method_name,
any  version,
any  id,
any  request_msg 
)

Creates a JSON-RPC request string from the parameters passed, without any line breaks.

To follow JSON-RPC specifications, the generated string will always be in UTF-8 encoding

Code Flags:
RET_VALUE_ONLY
Parameters:
method_namethe name of the JSON-RPC method to call
versionthe JSON-RPC version to include in the call
idthe ID of the call
request_msgthe parameters for the message/message payload
Returns:
a JSON string in UTF-8 encoding representing the JSON-RPC request
Exceptions:
JSON-SERIALIZATION-ERRORcannot serialize value passed (ex: binary, object)
Example:
my string $json = makeJSONRPCRequestString("omq.system.help", "1.0", $id, $msg);
See also:
string Qore::makeJSONRPCResponseString ( any  version,
any  id,
any  response_msg 
)

Creates a JSON-RPC response string from the parameters passed, without any line breaks.

Code Flags:
RET_VALUE_ONLY
Parameters:
versionthe JSON-RPC version to include in the call
idthe ID of the call
response_msgthe parameters for the message/message payload
Returns:
a JSON string in UTF-8 encoding representing the JSON-RPC response, without any line breaks
Exceptions:
JSON-SERIALIZATION-ERRORcannot serialize value passed (ex: binary, object)
Example:
my string $json = makeJSONRPCResponseString("1.0", $id, $msg);
See also: