Starting a UIPath Orchestrator Process via Google Appscript

Hi Team,

I am using the code below to initiate the UiPath process and facing an issue. Has anyone implemented a process to start the process using Google Apps Script?"

function createAndSendDocument() {

// Make a POST request with a JSON payload.
var data = {
‘grant_type’:‘refresh_token’,
‘client_id’:‘YOUR CLIENT ID’,
‘refresh_token’:‘YOUR REFRESH TOKEN’
};
var options = {
‘method’ : ‘post’,
‘contentType’: ‘application/json’,
‘headers’ : {‘X-UiPath-TenantName’:‘Default’},
‘payload’ : JSON.stringify(data)
};
var response = UrlFetchApp.fetch(‘https://automationsuite.io/identity_/connect/token’, options);
var jsonObject = JSON.parse(response.getContentText());

var data2 = {
/* ‘startInfo’: {
‘ReleaseKey’:‘e42be9b1-9d27-4b43-9583-723b67955ba5’,
‘Strategy’:‘All’
}*/
‘startInfo’: {
‘ReleaseKey’: ‘e42be9b1-9d27-4b43-9583-723b67955ba5’,
‘Strategy’: ‘ModernJobsCount’,
‘JobsCount’: 1,
‘InputArguments’: ‘{"io_AWS_Account":"dish-aws-control-tower-pe_review2_np","io_Account_Id":"572189693277","io_Instance_Id":"i-03be8bb7f98f41ab4"}’
}
};

var bear = 'Bearer '+jsonObject.access_token;

var options2 = {
‘method’ : ‘post’,
‘contentType’: ‘application/json’,
‘headers’ : {‘X-UiPath-TenantName’:‘YOUR TENANTNAME’, ‘Authorization’:bear},
‘payload’ : JSON.stringify(data2)
};
var response2 = UrlFetchApp.fetch(‘https://automationsuite/DefaultTenant/orchestrator_/odata/Jobs/UiPath.Server.Configuration.OData.StartJobs’, options2);
}

Error Message - 12:05:10 PM

Error

Exception: DNS error: https://automationsuite.rpa-uipath-np.aws.io/identity_/connect/token

createAndSendDocument

@ Code.gs:15

@Naveen_Chaganti

  1. I see a get request but startjobs is a post request
  2. Did you first happen to try the start job api on postman ?
  3. First execute on it wnd then replicate same on gapp script
  4. Also it needs a payload of what process,what is trigger type etc

A small article for help

Check swagger for further details

<OrchestratorURL>/swagger/index.html

Cheers

1 Like

Hi @Anil_G

I am able to trigger through postman facing issue with type script