Skip to main content

Connection functions

Connector Functions#

Connector Initialization#

Syntax:

variable = new Connection(String connectionName);

Example:

connection = new Connection("salesforce"); //salesforce - is the link name of the created connection.

HTTP functions#

get#

The get function corresponds to a HTTP GET request. It is normally supported by services to perform a read operation like fetching data.

Syntax:

connection.get(String url, Map paramsMap, Map headerMap);

Parameters:

ParamData typeDescription
urlStringThe URL which will return the response.
paramsMapMapVariable holding param values as key-value pairs.
headerMapMapVariable holding header values as key-value pairs.

Returns: String

Example:

url = "http://<some url to be fetched>";paramsMap = {};paramsMap.fetchLimit = 100;
headerMap = {};headerMap.Content-Type = "multipart/form-data";
response = connection.get(url, paramsMap, headerMap);log response; // response content as text

post#

The post url task corresponds to a HTTP POST request. It is normally supported by services to perform write operation like adding or updating data.

Syntax:

connection.post(String url, String bodyString, String bodyType,Map headerMap);

Parameters:

ParamData typeDescription
urlStringThe URL which will return the response.
bodyStringStringData to be posted.
bodyTypeStringType of the Data.
headerMapMapVariable holding header values as key-value pairs.

Returns: String

Example:

url = "http://<some url to be posted>";
bodyString = "Some dummy content to be posted";bodyType = "type of the content given in bodystring";
headerMap = {};headerMap.Content-Type = "multipart/form-data";
response = connection.post(url,bodyString,bodyType,headerMap);log response; // response content as text

Connected App Functions#

getVariable#

The getVariable function takes already created connectedApp name and the variable inside the connectedAPP as input and returns the value of that variable.

Syntax:

new NameSpace("connectedApp").getVariable(String connectedAppName, String variableName);

Parameters:

ParamData typeDescription
connectedAppNameStringThe name of the connected app.
variableNameStringThe name of the variable inside the connected app.

Returns: String

Example:

response = new NameSpace("connectedApp").getVariable("test","testing");log response;