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 invokeString
typeType of request String (Uppercase)
Eg: GET
headersHeaders that need to be includedJSON
payloadThe payload that needs to be includedJSON
serviceNameService name that is involved. It should be the same as the Connector created for this application.String
paramsRequest params that need to be sentJSON
fileDataThe desktop file attachment that needs to be uploadedBLOB
fileNameName of the file that has to be uploadedJSON
fileParamNameParameter name in which the file should be sentJSON
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);})