Invoke URL

Purpose

This command can be used to invoke any URL of your choice with the required authentication.

Request URL 

clientsdk.dispatch("invokeUrl", {xhrObj:{url: , type: , headers: , payload: , serviceName: , params: , fileData: , file:{ fileName: , fileParamName: }, attachPayload: }})

Request Parameters

ParameterDescriptionValue type 
urlThe API URL you wish to invoke.
Note: To invoke a URL, its domain must be included in the list of whiteListedDomains beforehand.
String
typeType of request.String (Uppercase)
Eg: GET
headersHeaders that need to be included.JSON
payloadThe payload that needs to be included.JSON
serviceNameService name that is involved. It should be the same as the Connector created for this application.String
paramsRequest params that need to be sent.JSON
fileDataThe desktop file attachment that needs to be uploaded.BLOB
fileNameName of the file that has to be uploaded.JSON
fileParamNameParameter name in which the file should be sent.JSON
attachPayload*Request body that needs to be sent with the file .JSON

* only needed for file upload

 

Sample Request

Copiedclientsdk.dispatch("invokeUrl", {xhrObj: {url:"https://api.github.com/users/sample", type:"GET", params:{}, headers:{"Content-Type":"application/json"}, file:{"fileName":"sample.png","fileParamName":"File"}, attachPayload:{}, fileData: , payload:{}, charset: "UTF-8"}}).then(function(successResponse){console.log(successResponse)}, function(errorResponse) {console.log(errorResponse);})

Note:
To invoke this sample URL, "https://api.github.com/users/sample", ensure the domain "https://api.github.com" is already added to the list of whiteListedDomains.