Qore JSON Module  1.8
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
string Qore::makeJSONRPCResponseString (any version, any id, any response_msg)
 Creates a JSON-RPC response string from the parameters passed, without any line breaks. More...
 
string Qore::make_jsonrpc11_error (softint code, string error, any id, any error_msg, *int format)
 Creates a JSON-RPC 1.1 error response string from the parameters passed, without any line breaks. More...
 
string Qore::make_jsonrpc_error (any version, any id, any error_msg, *int format)
 Creates a generic JSON-RPC error response string from the parameters passed, without any line breaks. More...
 
string Qore::make_jsonrpc_request (string method_name, any version, any id, any request_msg, *int format)
 Creates a JSON-RPC request string from the parameters passed, without any line breaks. More...
 
string Qore::make_jsonrpc_response (any version, any id, any response_msg, *int format)
 Creates a JSON-RPC response string from the parameters passed, without any line breaks. More...
 

Detailed Description

Function Documentation

◆ make_jsonrpc11_error()

string Qore::make_jsonrpc11_error ( softint  code,
string  error,
any  id,
any  error_msg,
*int  format 
)

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

Code Flags:
RET_VALUE_ONLY, DEPRECATED
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
formatoptional formatting flags; see JSON Generation Constants for more information
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:
string json = make_jsonrpc11_error(200, msg, id, error);
Since
json 1.5 as a replacement for deprecated camel-case makeJSONRPC11ErrorString() and makeFormattedJSONRPC11ErrorString()
Deprecated:
do not use; support for the non-published JSON-RPC 1.1 protocol was dropped in json 1.7
See also

◆ make_jsonrpc_error()

string Qore::make_jsonrpc_error ( any  version,
any  id,
any  error_msg,
*int  format 
)

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 under the "version" key (for JSON-RPC earlier than 2.0) or the "jsonrpc" key (for JSON-RPC equal to or greater than 2.0); will be converted to a string; if the resulting string is empty, the "version" key will not be sent; note that for strict JSON-RPC 1.0 compatibility this argument will not be serialized if passed as "1.0"
idthe ID of the call
error_msgthe parameters for the error response message/message payload
formatoptional formatting flags; see JSON Generation Constants for more information
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:
string json = make_jsonrpc_error("1.0", id, error);
Since
Note
do not use the version argument for strict JSON-RPC 1.0 compatibility (send as NOTHING)
See also

◆ make_jsonrpc_request()

string Qore::make_jsonrpc_request ( string  method_name,
any  version,
any  id,
any  request_msg,
*int  format 
)

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 under the "version" key (for JSON-RPC earlier than 2.0) or the "jsonrpc" key (for JSON-RPC equal to or greater than 2.0); will be converted to a string; if the resulting string is empty, the "version" key will not be sent; note that for strict JSON-RPC 1.0 compatibility this argument will not be serialized if passed as "1.0"
idthe ID of the call
request_msgthe parameters for the message/message payload
formatoptional formatting flags; see JSON Generation Constants for more information
Returns
a JSON string in UTF-8 encoding representing the JSON-RPC request
Exceptions
JSON-SERIALIZATION-ERRORcannot serialize value passed (ex: binary, object)
Example:
string json = make_jsonrpc_request("omq.system.help", "1.0", id, msg);
Since
Note
do not use the version argument for strict JSON-RPC 1.0 compatibility (send as NOTHING)
See also

◆ make_jsonrpc_response()

string Qore::make_jsonrpc_response ( any  version,
any  id,
any  response_msg,
*int  format 
)

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 under the "version" key (for JSON-RPC earlier than 2.0) or the "jsonrpc" key (for JSON-RPC equal to or greater than 2.0); will be converted to a string; if the resulting string is empty, the "version" key will not be sent; note that for strict JSON-RPC 1.0 compatibility this argument will not be serialized if passed as "1.0"
idthe ID of the call
response_msgthe parameters for the message/message payload
formatoptional formatting flags; see JSON Generation Constants for more information
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:
string json = make_jsonrpc_response("1.0", id, msg);
Since
Note
do not use the version argument for strict JSON-RPC 1.0 compatibility (send as NOTHING)
See also

◆ makeFormattedJSONRPC11ErrorString()

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, DEPRECATED
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)
Deprecated:
do not use; camel-case function names were deprecated in json 1.5, and support for the non-published JSON-RPC 1.1 protocol was dropped in json 1.7
See also

◆ makeFormattedJSONRPCErrorString()

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, DEPRECATED
Parameters
versionthe JSON-RPC version to include in the call under the "version" key (for JSON-RPC earlier than 2.0) or the "jsonrpc" key (for JSON-RPC equal to or greater than 2.0); will be converted to a string; if the resulting string is empty, the "version" key will not be sent; note that for strict JSON-RPC 1.0 compatibility this argument will not be serialized if passed as "1.0"
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)
Deprecated:
use make_jsonrpc_error(); camel-case function names were deprecated in json 1.5
Note
do not use the version argument for strict JSON-RPC 1.0 compatibility (send as NOTHING)
See also

◆ makeFormattedJSONRPCRequestString()

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, DEPRECATED
Parameters
method_namethe name of the JSON-RPC method to call
versionthe JSON-RPC version to include in the call under the "version" key (for JSON-RPC earlier than 2.0) or the "jsonrpc" key (for JSON-RPC equal to or greater than 2.0); will be converted to a string; if the resulting string is empty, the "version" key will not be sent; note that for strict JSON-RPC 1.0 compatibility this argument will not be serialized if passed as "1.0"s
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)
Deprecated:
use make_jsonrpc_request(); camel-case function names were deprecated in json 1.5
Note
do not use the version argument for strict JSON-RPC 1.0 compatibility (send as NOTHING)
See also

◆ makeFormattedJSONRPCResponseString()

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, DEPRECATED
Parameters
versionthe JSON-RPC version to include in the call under the "version" key (for JSON-RPC earlier than 2.0) or the "jsonrpc" key (for JSON-RPC equal to or greater than 2.0); will be converted to a string; if the resulting string is empty, the "version" key will not be sent; note that for strict JSON-RPC 1.0 compatibility this argument will not be serialized if passed as "1.0"
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)
Deprecated:
use make_jsonrpc_response(); camel-case function names were deprecated in json 1.5
Note
do not use the version argument for strict JSON-RPC 1.0 compatibility (send as NOTHING)
See also

◆ makeJSONRPC11ErrorString()

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, DEPRECATED
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)
Deprecated:
do not use; camel-case function names were deprecated in json 1.5, and support for the non-published JSON-RPC 1.1 protocol was dropped in json 1.7
See also

◆ makeJSONRPCErrorString()

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, DEPRECATED
Parameters
versionthe JSON-RPC version to include in the call under the "version" key (for JSON-RPC earlier than 2.0) or the "jsonrpc" key (for JSON-RPC equal to or greater than 2.0); will be converted to a string; if the resulting string is empty, the "version" key will not be sent; note that for strict JSON-RPC 1.0 compatibility this argument will not be serialized if passed as "1.0"
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)
Deprecated:
use make_jsonrpc_error(); camel-case function names were deprecated in json 1.5
Note
do not use the version argument for strict JSON-RPC 1.0 compatibility (send as NOTHING)
See also

◆ makeJSONRPCRequestString()

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, DEPRECATED
Parameters
method_namethe name of the JSON-RPC method to call
versionthe JSON-RPC version to include in the call under the "version" key (for JSON-RPC earlier than 2.0) or the "jsonrpc" key (for JSON-RPC equal to or greater than 2.0); will be converted to a string; if the resulting string is empty, the "version" key will not be sent; for strict JSON-RPC 1.0 compatibility this argument will not be serialized if passed as "1.0"
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)
Deprecated:
use make_jsonrpc_request(); camel-case function names were deprecated in json 1.5
Note
do not use the version argument for strict JSON-RPC 1.0 compatibility (send as NOTHING)
See also

◆ makeJSONRPCResponseString()

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, DEPRECATED
Parameters
versionthe JSON-RPC version to include in the call under the "version" key (for JSON-RPC earlier than 2.0) or the "jsonrpc" key (for JSON-RPC equal to or greater than 2.0); will be converted to a string; if the resulting string is empty, the "version" key will not be sent; note that for strict JSON-RPC 1.0 compatibility this argument will not be serialized if passed as "1.0"
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)
Deprecated:
use make_jsonrpc_response(); camel-case function names were deprecated in json 1.5
Note
do not use the version argument for strict JSON-RPC 1.0 compatibility (send as NOTHING)
See also