Qorus Integration Engine®  4.1.4.p4_git
OMQ::QorusSystemRestHelperBase Class Referenceabstract

base class for accessing the system REST API More...

Inheritance diagram for OMQ::QorusSystemRestHelperBase:
DataStreamClient::DataStreamClient OMQ::Client::QorusSystemRestHelper OMQ::QorusSystemRestHelper OMQ::Client::QorusLocalRestHelper

Public Member Methods

 constructor (*hash< auto > opts, *softbool do_not_connect)
 creates the object with the given options; a connection is automatically made unless the do_not_connect argument is False More...
 
 setURL (string url)
 sets the URL for the object
 
hash< auto > restDoWithInfo (string m, string path, auto args, *hash< auto > hdr, *hash< auto > opt)
 executes the remote REST call and returns the response More...
 
abstract auto restDo (string m, string path, auto args, *hash< auto > hdr, *hash< auto > opt, *reference< hash > info)
 executes the remote REST call and returns the response More...
 
auto get (string path, auto args, *hash< auto > hdr, *reference< hash > info)
 executes a GET call on the remote REST service and returns the response More...
 
hash< auto > getWithInfo (string path, auto args, *hash< auto > hdr)
 executes a GET call on the remote REST service and returns the response More...
 
auto put (string path, auto args, *hash< auto > hdr, *reference< hash > info)
 executes a PUT call on the remote REST service and returns the response More...
 
hash< auto > putWithInfo (string path, auto args, *hash< auto > hdr)
 executes a PUT call on the remote REST service and returns the response More...
 
auto post (string path, auto args, *hash< auto > hdr, *reference< hash > info)
 executes a POST call on the remote REST service and returns the response More...
 
hash< auto > postWithInfo (string path, auto args, *hash< auto > hdr)
 executes a POST call on the remote REST service and returns the response More...
 
auto del (string path, auto args, *hash< auto > hdr, *reference< hash > info)
 executes a DELETE call on the remote REST service and returns the response More...
 
hash< auto > delWithInfo (string path, auto args, *hash< auto > hdr)
 executes a DELETE call on the remote REST service and returns the response More...
 
hash< auto > doRequest (string m, string path, auto body, *reference< hash > info, softbool decode_errors=True, *hash< auto > hdr)
 sends an HTTP request to the REST server and returns the response More...
 

Static Public Member Methods

static hash< auto > toConfig (hash< auto > info)
 returns a hash of configuration information for the object
 

Public Attributes

const Defaults
 default values for connection options
 

Private Member Methods

abstract autoSetUrl (*hash< auto > opts)
 sets the URL automatically; must be reimplemented in subclasses
 
abstract nothing warning (string fmt)
 issue a warning on the console (for the client) or in the current log file (for the server) More...
 

Detailed Description

base class for accessing the system REST API

Member Function Documentation

◆ constructor()

OMQ::QorusSystemRestHelperBase::constructor ( *hash< auto >  opts,
*softbool  do_not_connect 
)

creates the object with the given options; a connection is automatically made unless the do_not_connect argument is False

Parameters
optsoptions as follows:
  • api_version: the REST API version (defaults to the latest version)
  • connect_timeout: the connect timeout value in milliseconds
  • timeout: the socket I/O timeout value in milliseconds
  • url: the target URL
do_not_connectif True, then the object will be created in an unconnected state
Since
Qorus 3.1.1 added the api_version option

◆ del()

auto OMQ::QorusSystemRestHelperBase::del ( string  path,
auto  args,
*hash< auto >  hdr,
*reference< hash info 
)

executes a DELETE call on the remote REST service and returns the response

Parameters
paththe URI path for the request
argsany arguments to the REST request
hdra hash of optional HTTP header info to add to the request
infoan optional reference to a hash that will be used as an output variable giving a hash of request headers and other information about the HTTP request; if present the hash will contain the following keys:
  • headers: a hash of outgoing HTTP request headers
  • request-uri: the request URI string sent (ex: "DELETE /users/olduser HTTP/1.1")
  • body-content-type: the outgoing message body Mime Content-Type value
  • response-headers: a hash of incoming HTTP headers in the response
  • chunked: set to True if the response was received with chunked transfer encoding
  • response-code: the HTTP response code
  • response-body: the raw message body in the response (after any content decoding)
  • response-serialization: the type of message serialization in the response; see RestClient::RestClient::DataSerializationOptions for possible values
  • request-body: the raw message body in the request (before any content encoding)
  • request-serialization: the type of message serialization in the request; see RestClient::RestClient::DataSerializationOptions for possible values
Returns
the deserialized response body

◆ delWithInfo()

hash<auto> OMQ::QorusSystemRestHelperBase::delWithInfo ( string  path,
auto  args,
*hash< auto >  hdr 
)

executes a DELETE call on the remote REST service and returns the response

Parameters
paththe URI path for the request
argsany arguments to the REST request
hdra hash of optional HTTP header info to add to the request
Returns
a hash with the following keys:
  • rv: the deserialized response body
  • info: a hash of request headers and other information about the HTTP request; if present the hash will contain the following keys:
    • headers: a hash of outgoing HTTP request headers
    • request-uri: the request URI string sent (ex: "DELETE /users/olduser HTTP/1.1")
    • body-content-type: the outgoing message body Mime Content-Type value
    • response-headers: a hash of incoming HTTP headers in the response
    • chunked: set to True if the response was received with chunked transfer encoding
    • response-code: the HTTP response code
    • response-body: the raw message body in the response (after any content decoding)
    • response-serialization: the type of message serialization in the response; see RestClient::RestClient::DataSerializationOptions for possible values
    • request-body: the raw message body in the request (before any content encoding)
    • request-serialization: the type of message serialization in the request; see RestClient::RestClient::DataSerializationOptions for possible values
Since
Qorus 4.0

◆ doRequest()

hash<auto> OMQ::QorusSystemRestHelperBase::doRequest ( string  m,
string  path,
auto  body,
*reference< hash info,
softbool  decode_errors = True,
*hash< auto >  hdr 
)

sends an HTTP request to the REST server and returns the response

Example:
hash<auto> ans = rest.doRequest("DELETE", "/orders/1");
See also
RestClient::RestClient::doRequest() for details
Note
This method will attempt to switch to the base API level if set to "latest" and a URI path error is returned from the server
Since
Qorus 3.1.1

◆ get()

auto OMQ::QorusSystemRestHelperBase::get ( string  path,
auto  args,
*hash< auto >  hdr,
*reference< hash info 
)

executes a GET call on the remote REST service and returns the response

Parameters
paththe URI path for the request
argsany arguments to the REST request
hdra hash of optional HTTP header info to add to the request
infoan optional reference to a hash that will be used as an output variable giving a hash of request headers and other information about the HTTP request; if present the hash will contain the following keys:
  • headers: a hash of outgoing HTTP request headers
  • request-uri: the request URI string sent (ex: "GET /services/async/38.0/job HTTP/1.1")
  • body-content-type: the outgoing message body Mime Content-Type value
  • response-headers: a hash of incoming HTTP headers in the response
  • chunked: set to True if the response was received with chunked transfer encoding
  • response-code: the HTTP response code
  • response-body: the raw message body in the response (after any content decoding)
  • response-serialization: the type of message serialization in the response; see RestClient::RestClient::DataSerializationOptions for possible values
  • request-body: the raw message body in the request (before any content encoding)
  • request-serialization: the type of message serialization in the request; see RestClient::RestClient::DataSerializationOptions for possible values
Returns
the deserialized response body

◆ getWithInfo()

hash<auto> OMQ::QorusSystemRestHelperBase::getWithInfo ( string  path,
auto  args,
*hash< auto >  hdr 
)

executes a GET call on the remote REST service and returns the response

Parameters
paththe URI path for the request
argsany arguments to the REST request
hdra hash of optional HTTP header info to add to the request
Returns
a hash with the following keys:
  • rv: the deserialized response body
  • info: a hash of request headers and other information about the HTTP request; if present the hash will contain the following keys:
    • headers: a hash of outgoing HTTP request headers
    • request-uri: the request URI string sent (ex: "GET /services/async/38.0/job HTTP/1.1")
    • body-content-type: the outgoing message body Mime Content-Type value
    • response-headers: a hash of incoming HTTP headers in the response
    • chunked: set to True if the response was received with chunked transfer encoding
    • response-code: the HTTP response code
    • response-body: the raw message body in the response (after any content decoding)
    • response-serialization: the type of message serialization in the response; see RestClient::RestClient::DataSerializationOptions for possible values
    • request-body: the raw message body in the request (before any content encoding)
    • request-serialization: the type of message serialization in the request; see RestClient::RestClient::DataSerializationOptions for possible values
Since
Qorus 4.0

◆ post()

auto OMQ::QorusSystemRestHelperBase::post ( string  path,
auto  args,
*hash< auto >  hdr,
*reference< hash info 
)

executes a POST call on the remote REST service and returns the response

Parameters
paththe URI path for the request
argsany arguments to the REST request
hdra hash of optional HTTP header info to add to the request
infoan optional reference to a hash that will be used as an output variable giving a hash of request headers and other information about the HTTP request; if present the hash will contain the following keys:
  • headers: a hash of outgoing HTTP request headers
  • request-uri: the request URI string sent (ex: "POST /services/async/38.0/job HTTP/1.1")
  • body-content-type: the outgoing message body Mime Content-Type value
  • response-headers: a hash of incoming HTTP headers in the response
  • chunked: set to True if the response was received with chunked transfer encoding
  • response-code: the HTTP response code
  • response-body: the raw message body in the response (after any content decoding)
  • response-serialization: the type of message serialization in the response; see RestClient::RestClient::DataSerializationOptions for possible values
  • request-body: the raw message body in the request (before any content encoding)
  • request-serialization: the type of message serialization in the request; see RestClient::RestClient::DataSerializationOptions for possible values
Returns
the deserialized response body

◆ postWithInfo()

hash<auto> OMQ::QorusSystemRestHelperBase::postWithInfo ( string  path,
auto  args,
*hash< auto >  hdr 
)

executes a POST call on the remote REST service and returns the response

Parameters
paththe URI path for the request
argsany arguments to the REST request
hdra hash of optional HTTP header info to add to the request
Returns
a hash with the following keys:
  • rv: the deserialized response body
  • info: a hash of request headers and other information about the HTTP request; if present the hash will contain the following keys:
    • headers: a hash of outgoing HTTP request headers
    • request-uri: the request URI string sent (ex: "POST /services/async/38.0/job HTTP/1.1")
    • body-content-type: the outgoing message body Mime Content-Type value
    • response-headers: a hash of incoming HTTP headers in the response
    • chunked: set to True if the response was received with chunked transfer encoding
    • response-code: the HTTP response code
    • response-body: the raw message body in the response (after any content decoding)
    • response-serialization: the type of message serialization in the response; see RestClient::RestClient::DataSerializationOptions for possible values
    • request-body: the raw message body in the request (before any content encoding)
    • request-serialization: the type of message serialization in the request; see RestClient::RestClient::DataSerializationOptions for possible values
Since
Qorus 4.0

◆ put()

auto OMQ::QorusSystemRestHelperBase::put ( string  path,
auto  args,
*hash< auto >  hdr,
*reference< hash info 
)

executes a PUT call on the remote REST service and returns the response

Parameters
paththe URI path for the request
argsany arguments to the REST request
hdra hash of optional HTTP header info to add to the request
infoan optional reference to a hash that will be used as an output variable giving a hash of request headers and other information about the HTTP request; if present the hash will contain the following keys:
  • headers: a hash of outgoing HTTP request headers
  • request-uri: the request URI string sent (ex: "PUT /services/async/38.0/job HTTP/1.1")
  • body-content-type: the outgoing message body Mime Content-Type value
  • response-headers: a hash of incoming HTTP headers in the response
  • chunked: set to True if the response was received with chunked transfer encoding
  • response-code: the HTTP response code
  • response-body: the raw message body in the response (after any content decoding)
  • response-serialization: the type of message serialization in the response; see RestClient::RestClient::DataSerializationOptions for possible values
  • request-body: the raw message body in the request (before any content encoding)
  • request-serialization: the type of message serialization in the request; see RestClient::RestClient::DataSerializationOptions for possible values
Returns
the deserialized response body

◆ putWithInfo()

hash<auto> OMQ::QorusSystemRestHelperBase::putWithInfo ( string  path,
auto  args,
*hash< auto >  hdr 
)

executes a PUT call on the remote REST service and returns the response

Parameters
paththe URI path for the request
argsany arguments to the REST request
hdra hash of optional HTTP header info to add to the request
Returns
a hash with the following keys:
  • rv: the deserialized response body
  • info: a hash of request headers and other information about the HTTP request; if present the hash will contain the following keys:
    • headers: a hash of outgoing HTTP request headers
    • request-uri: the request URI string sent (ex: "PUT /services/async/38.0/job HTTP/1.1")
    • body-content-type: the outgoing message body Mime Content-Type value
    • response-headers: a hash of incoming HTTP headers in the response
    • chunked: set to True if the response was received with chunked transfer encoding
    • response-code: the HTTP response code
    • response-body: the raw message body in the response (after any content decoding)
    • response-serialization: the type of message serialization in the response; see RestClient::RestClient::DataSerializationOptions for possible values
    • request-body: the raw message body in the request (before any content encoding)
    • request-serialization: the type of message serialization in the request; see RestClient::RestClient::DataSerializationOptions for possible values
Since
Qorus 4.0

◆ restDo()

abstract auto OMQ::QorusSystemRestHelperBase::restDo ( string  m,
string  path,
auto  args,
*hash< auto >  hdr,
*hash< auto >  opt,
*reference< hash info 
)
pure virtual

executes the remote REST call and returns the response

Parameters
mthe HTTP method for the request (ex: "GET")
paththe URI path for the request
argsany arguments to the REST request
hdra hash of optional HTTP header info to add to the request
optoutput options; as defined in the child class
infoan optional reference to a hash that will be used as an output variable giving a hash of request headers and other information about the HTTP request; if present the hash will contain the following keys:
  • headers: a hash of outgoing HTTP request headers
  • request-uri: the request URI string sent (ex: "GET /services/async/38.0/job HTTP/1.1")
  • body-content-type: the outgoing message body Mime Content-Type value
  • response-headers: a hash of incoming HTTP headers in the response
  • chunked: set to True if the response was received with chunked transfer encoding
  • response-code: the HTTP response code
  • response-body: the raw message body in the response (after any content decoding)
  • response-serialization: the type of message serialization in the response; see RestClient::RestClient::DataSerializationOptions for possible values
  • request-body: the raw message body in the request (before any content encoding)
  • request-serialization: the type of message serialization in the request; see RestClient::RestClient::DataSerializationOptions for possible values
Returns
the deserialized response body

Implemented in OMQ::QorusSystemRestHelper.

◆ restDoWithInfo()

hash<auto> OMQ::QorusSystemRestHelperBase::restDoWithInfo ( string  m,
string  path,
auto  args,
*hash< auto >  hdr,
*hash< auto >  opt 
)

executes the remote REST call and returns the response

Parameters
mthe HTTP method for the request (ex: "GET")
paththe URI path for the request
argsany arguments to the REST request
hdra hash of optional HTTP header info to add to the request
optoutput options; as defined in the child class
Returns
a hash with the following keys:
  • rv: the deserialized response body
  • info: a hash of request headers and other information about the HTTP request; if present the hash will contain the following keys:
    • headers: a hash of outgoing HTTP request headers
    • request-uri: the request URI string sent (ex: "GET /services/async/38.0/job HTTP/1.1")
    • body-content-type: the outgoing message body Mime Content-Type value
    • response-headers: a hash of incoming HTTP headers in the response
    • chunked: set to True if the response was received with chunked transfer encoding
    • response-code: the HTTP response code
    • response-body: the raw message body in the response (after any content decoding)
    • response-serialization: the type of message serialization in the response; see RestClient::RestClient::DataSerializationOptions for possible values
    • request-body: the raw message body in the request (before any content encoding)
    • request-serialization: the type of message serialization in the request; see RestClient::RestClient::DataSerializationOptions for possible values
Since
Qorus 4.0

◆ warning()

abstract nothing OMQ::QorusSystemRestHelperBase::warning ( string  fmt)
privatepure virtual

issue a warning on the console (for the client) or in the current log file (for the server)

Since
Qorus 3.1.1

Implemented in OMQ::Client::QorusSystemRestHelper, and OMQ::QorusSystemRestHelper.


The documentation for this class was generated from the following file: