cui.js Calls

cui.api(options)
Create a cui.js object.

Note. This call is made directly, without being attached to any other object or namespace.
options.defs
Array

An array, whose objects define the API calls to expose to the App. If the object is a string, it is presumed to be a Url to remotely defined definitions, which are loaded asynchronously. Otherwise the definitions are presumed to be in the proper call definition object format.
options.proxyUrl
String

Optional.
The URL (without slashes !) of the proxy server to which the App will send its API calls. The value will be appended to the server URL that is otherwise constructed using the serviceUrl property. If not supplied here, can be set later via the MyCuiJs.setProxyUrl() call (below).
options.retryUnsecured
Boolean

Optional.
(Defaults to true). If true, forces cui.js to always retry unsecured calls that fail because the SolutionId is missing. This is useful in scenarios when post-authentication info is arriving asynchronously (and being cached by cui.js), while the App is simultaneously making calls that depend upon its existence.
options.serviceUrl
String

Optional.
The server to which the App will send its API calls. The value can be a recognized API platform abbreviation or an explicit url. If not supplied here, can be set later via the MyCuiJs.setServiceUrl() call (below).
options.sessionId
String

Optional.
Uniquely identifies each cui.js object in App's that are using more than one cui.js object simultaneously.
Returns
Promise

If successful, resolves with a cui.js object, that is then used to make subsequent API calls.
cui.apiAsync()
Synonym for the cui.api call (see above).
Returns


cui.apiSync(options)
Alternative way to create a cui.js object.

Note. This call is made directly, without being attached to any other object or namespace.
options.defs
Array

An array, whose objects define the API calls to expose to the App. The objects must be proper call definition objects, which are then synchronously loaded.
options.proxyUrl
String

Optional.
The URL (without slashes !) of the proxy server to which the App will send its API calls. The value will be appended to the server URL that is otherwise constructed using the serviceUrl property. If not supplied here, can be set later via the MyCuiJs.setProxyUrl() call (below).
options.retryUnsecured
Boolean

Optional.
(Defaults to true). If true, forces cui.js to always retry unsecured calls that fail because the SolutionId is missing. This is useful in scenarios when post-authentication info is arriving asynchronously (and being cached by cui.js), while the App is simultaneously making calls that depend upon its existence.
options.serviceUrl
String

Optional.
The server to which the App will send its API calls. The value can be a recognized API platform abbreviation or an explicit url. If not supplied here, can be set later via the MyCuiJs.setServiceUrl() call (below).
options.sessionId
String

Optional.
Uniquely identifies each cui.js object in App's that are using more than one cui.js object simultaneously.
Returns
Object

The cui.js object, that is then used to make subsequent API calls.
cui.disableLog()
Disable cui.js debug messages in the browser console.

This call can be issued dynamically in the browser's console, or be present in the App's code. Note that the call takes precedence over whatever `cui.log` setting exists in the browser's local storage.

Note. This call is made directly, without being attached to any other object or namespace.
Returns


cui.enableLog()
Enable cui.js debug messages in the browser console.

This call can be issued dynamically in the browser's console, or be present in the App's code. Note that the call takes precedence over whatever `cui.log` setting exists in the browser's local storage.

Note. This call is made directly, without being attached to any other object or namespace.
Returns


cui.log(message)
Print message in the browser console.

Note. This call is made directly, without being attached to any other object or namespace.
message


The message to be logged. Same as what can be passed to console.log(). Takes any type of Javascript object or objects, either comma-delimited on concatenated.
Returns


getProxyUrl()
Get the cached API proxy URL.
Returns
String

The URL (with prepended slash) of the proxy server to which the App will send its API calls.
getServiceUrl()
Get the cached API Environment.
Returns
String

The host URL to which all API calls are currently being directed.
parseError(error)
Parse an error object returned from an API call, returning a brief error description.
error
Object

The error response object from an API call. Arrives as the parameter in a .fail(error) handler.
Returns
String

A brief text description of the underlying error.
setProxyUrl(proxyName)
Set the API proxy URL.
proxyName
String

The URL (without slashes !) of the proxy server to which the App will send its API calls. The value will be appended to the server URL that is otherwise constructed using the serviceUrl property.
Returns
String

The URL (with prepended slash) of the proxy server to which the App will send its API calls.
setServiceUrl(environment)
Set the API Environment.
environment
String

The hostname to which all API calls will be directed.

Note, value can either be an explicit URL, or an built-in environment abbreviation.
Returns
String

The host URL to which all API calls are currently being directed.
version()
Get the version of cui.js.
Returns
String

The version of cui.js, in major.minor.patch format.