Connection functions
#
Connector Functions#
Connector InitializationSyntax:
variable = new Connection(
String
connectionName);
Example:
connection = new Connection("salesforce"); //salesforce - is the link name of the created connection.
#
HTTP functions#
getThe 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:
Param | Data type | Description |
---|---|---|
url | String | The URL which will return the response. |
paramsMap | Map | Variable holding param values as key-value pairs. |
headerMap | Map | Variable 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
#
postThe 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:
Param | Data type | Description |
---|---|---|
url | String | The URL which will return the response. |
bodyString | String | Data to be posted. |
bodyType | String | Type of the Data. |
headerMap | Map | Variable 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#
getVariableThe 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:
Param | Data type | Description |
---|---|---|
connectedAppName | String | The name of the connected app. |
variableName | String | The name of the variable inside the connected app. |
Returns: String
Example:
response = new NameSpace("connectedApp").getVariable("test","testing");log response;