How can I make call Kofax robot and run in Google apps script? ,using javascript and rest api

42 views Asked by At

I've been trying to make robot run in google apps script from a Kofax robot management console, using rest api, but it doesn't work at all.

regardless of knowledge about Kofax, please find wrong part of my code.

I'm beginner at javascript, so I really glad if I cat get some advice about this problem.


function callKofaxRoboRestApi() {

var endpointUrl = '**rest api url**';

var requestParams = {
'username': 'my user name',
'password': 'my password'
};

const accessToken = "**my token**";

var headers = {
'Authorization': 'Bearer ' + accessToken,
'Content-Type': 'application/json',
};

var options = {
'method': 'post',
'headers': headers,
'payload': JSON.stringify(requestParams)
};

var data = {
'entry': {
'group': {
'name': '**robot name**',
'type': 'robot'
}
}
};

var payload = JSON.stringify(data);

var response = UrlFetchApp.fetch(endpointUrl, options);
var responseData = JSON.parse(response.getContentText());

if (response.getResponseCode() == 200) {
Logger.log('success');
} else {
Logger.log('looser');
}

It return 'Exeption: Address unavailabl:https//rpa3.cm-system/...callkofaxRoboRestApi @kofax.documatation gs:38

Is there something wrong? or skipped code?

0

There are 0 answers