Qore ZeyosRestClient Module Reference  1.0
ZeyosRestClient::ZeyosRestClient Class Reference

this class provides the REST client API for communication with zeyos.com's CRM ERP system More...

Inheritance diagram for ZeyosRestClient::ZeyosRestClient:

Public Member Methods

 constructor (hash options, *softbool do_not_connect)
 creates the object with the given options More...
 

Static Public Member Methods

static hash getOptions (hash options)
 returns options for the RestClient::constructor()
 

Detailed Description

this class provides the REST client API for communication with zeyos.com's CRM ERP system

This class requires the following options for zeyos.com's authentication and authorization to the target server:

  • name: the zeyos.com's name
  • password: the zeyos.com's password
  • identifier: the zeyos.com's identifier
  • appsecret: the zeyos.com's appsecret
  • token: the zeyos.com's token, if provided then name, password, identifier and appsecret are not needed and will be ignored.

The ZeyosRestClient class will receive a token that will be used in further communication. Also the token can be provided directly in the options and then there is no need to pass the above options.

Member Function Documentation

◆ constructor()

ZeyosRestClient::ZeyosRestClient::constructor ( hash  options,
*softbool  do_not_connect 
)

creates the object with the given options

Example:
ZeyosRestClient zeyos(
{
"url": "https://cloud.zeyos.com/test",
"name": "test", "password": "test", "identifier": "id",
"appsecret": "8df3cc8be92d300edb9ff9b9a680d22eacbf2ee5"
});
Parameters
optionsvalid options are:
  • name (mandatory): the zeyos.com's name
  • password (mandatory): the zeyos.com's password
  • identifier (mandatory): the zeyos.com's identifier
  • appsecret (mandatory): the zeyos.com's appsecret
  • token: the zeyos.com's token, if provided then name, password, identifier and appsecret are not needed and will be ignored.
  • additional_methods: Optional hash with more but not-HTTP-standardized methods to handle. It allows to create various HTTP extensions like e.g. WebDAV. The hash takes the method name as a key, and the value is a boolean True or False: indicating if the method requires a message body as well. Example:
    # add new HTTP methods for WebDAV. Both of them require body posting to the server
    ("additional_methods": ("PROPFIND": True, "MKCOL": True ));
  • connect_timeout: The timeout value in milliseconds for establishing a new socket connection (also can be a relative date-time value for clarity, ex: 20s)
  • content_encoding: for possible values, see EncodingSupport; this sets the send encoding (if the "send_encoding" option is not set) and the requested response encoding (note that the RestClient class will only compress outgoing message bodies over CompressionThreshold bytes in size)
  • data: a data serialization option; if not present defaults to "auto"
  • default_path: The default path to use for new connections if a path is not otherwise specified in the connection URL
  • default_port: The default port number to connect to if none is given in the URL
  • headers: an optional hash of headers to send with every request, these can also be overridden in request method calls
  • http_version: Either '1.0' or '1.1' for the claimed HTTP protocol version compliancy in outgoing message headers
  • max_redirects: The maximum number of redirects before throwing an exception (the default is 5)
  • proxy: The proxy URL for connecting through a proxy
  • send_encoding: a send data encoding option or the value "auto" which means to use automatic encoding; if not present defaults to no content-encoding on sent message bodies (note that the RestClient class will only compress outgoing message bodies over CompressionThreshold bytes in size)
  • swagger: the path to a Swagger 2.0 REST schema file for API validation; only used if validator not provided (see the Swagger module)
  • timeout: The timeout value in milliseconds (also can be a relative date-time value for clarity, ex: 30s)
  • url: A string giving the URL to connect to; if not given then the target URL will be taken from any validator option, if given by calling AbstractRestSchemaValidator::getTargetUrl()
  • validator: an AbstractRestSchemaValidator object to validate request and response messages; overrides swagger
  • no_charset: if True no charset will be added to the Content-Type header (should be set to True if data are sent in the body). Default is True if not passed.
do_not_connectif False (the default), then a connection will be immediately established to the remote server
Exceptions
RESTCLIENT-ERRORinvalid option passed to constructor, unsupported data serialization, etc
ZEYOSRESTCLIENT-ERRORmissing or invalid required option for Zeyos.com's REST authentication or communication