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
Argument | Type | Description | |
---|---|---|---|
name | String, required | The name given to the API Server connection. This is then used in calls to utilsIsAPIServerDefined and utilInvokeAPIServer. | |
url | String, required | Full or partial URL to the API Server Worker | |
options | Object, required | apiKey | String, optional. The API Key, if required |
user | String, optional. The username, if required | ||
password | String, optional. The password, if required | ||
forceJSONP | Boolean, optional | ||
internal | Boolean, optional |
Returns
Object
Example
See .utilInvokeAPIServer for a full example.