Toggle menu

helper.utilCreateAPIServer(name, url, options)

Configures a connection to a Worker Service provided by a particular API Server.

When working server-side .utilServerAPIServerCall can be used to communicate with the API Server - it's a lot simpler to use.

The connection can be invoked client and server-side. As a minimum the name for the connection and a partial URL must be provided.

The name is used when actually invoking a method on the worker. See .utilInvokeAPIServer.

The URL can be the full URL to the required worker or, if executed server-side, just the name of the worker. Client side the URL should be the path to the worker relative to the page URL (./apiserver/NameOfWorker for base URL paths other than "/"). Note that API Server Security will restrict the workers available client-side.

For client-side requests the use of the JSONP protocol can be forced by setting the forceJSONP option to true.

For server-side requests, workers within the INTERNAL key can be called by setting the internal option to true.

Executed

May be used client or server-side.

Arguments

ArgumentTypeDescription
nameString, requiredThe name given to the API Server connection. This is then used in calls to utilsIsAPIServerDefined and utilInvokeAPIServer.
urlString, requiredFull or partial URL to the API Server Worker
optionsObject, requiredapiKeyString, optional. The API Key, if required
userString, optional. The username, if required
passwordString, optional. The password, if required
forceJSONPBoolean, optional
internalBoolean, optional

Returns

Object

Example

See .utilInvokeAPIServer for a full example.

Last modified on September 29, 2022

Share this page

Facebook icon Twitter icon email icon

Print

print icon