Gateway Server Programming API
See Also: Gateway Server, Gateway Server RESTful Services
The Gateway Server API is divided into two sections:
The following API methods can only be called on a Gateway Server and when the Gateway Server license feature is enabled. This can be checked in the Server Administration Application. If the Gateway Server license is not enabled a runtime error will be shown and the function will not execute.
Function Name |
Description |
JavaScript Example |
Calls a form on the Remote Server with no additional parameters. The current user session on the Gateway Server is terminated and control is transferred to the Remote Server. Parameters remoteServer – name of the Remote Server as configured in the Server Administration Application. The configured Base URL is used to assemble the Remote Server form URL. formName – The name of the form to go to on the Remote Server. A Gateway Authentication Token is automatically added to the request sent to the Remote Server. |
importPackage(com.ebasetech.xi.api); importPackage(com.ebasetech.xi.services); var remoteServer =
"remoteServer1"; var formName = "customers"; gateway.gotoForm(remoteServer, formName); |
|
Calls a form on the Remote Server with additional parameters. The current user session on the Gateway Server is terminated and control is transferred to the Remote Server. Parameters remoteServer – name of the Remote Server that is configured in the Server Administration Application. The configured Base URL is used to assemble the Remote Server form URL. formName – The name of the form to go to on the Remote Server. parameters – additional parameters to be passed to the remote form. A Gateway Authentication Token is automatically added to the request sent to the Remote Server. |
importPackage(com.ebasetech.xi.api); importPackage(com.ebasetech.xi.services); var remoteServer =
"remoteServer1"; var formName = "customerDetails"; var params = {}; params.customerId = 1; gateway.callForm(remoteServer, formName,
params); |
|
Returns a list of configured RemoteServers that have been configured using the Server Administration Application. |
importPackage(com.ebasetech.xi.api); importPackage(com.ebasetech.xi.services); var remoteServers = gateway.getRemoteServers(); remoteServers.forEach(debugServers); //debug servers function
debugServers(value, index, array) { log(value.getServerName()); } |
|
Returns true if the Gateway License feature is enabled |
|
The following methods invoke services on a Gateway Server from a Remote Server. They can be called on any server.
Function Name |
Description |
JavaScript Example |
Returns the GatewayRestServices object that supports REST service calls from a Remote Server to a Gateway Server. An authorization HTTP header is added automatically to every HTTP request. GatewayRestServices is an extension of RestServices and includes all the same methods get(), put(), post(), delete() etc. But each method takes the Gateway Server name (as configured in the Server Administration Application) as the first parameter, and the target URL parameter is the relative path on the target Gateway Server – see the example to the right. |
importPackage(com.ebasetech.xi.api); importPackage(com.ebasetech.xi.services); var response = gateway.rest.get("MyCorp_Gateway", "/customers/getCustomer"); if (response.isSuccess()) { var results = JSON.parse(response.getBody()); .. }
where..
|