How to call a UiPath robot with POST request


#1

Hello,

I’m a complete rookie at UiPath, having only created simple robots with it. I’m working with an application in NodeJS and I would like to call an UiPath robot with a POST request, but I’m encountering some issues. Despite searching, I couldn’t find an answer in the forums. It would be very helpful if someone could take a look at my code and tell me if I’m doing something wrong.

[…]

var jsonObject = {
WorkflowFile: “C:\…\Main.xaml”,
User: “test”,
Password: “password”,
Type: 0
}

var options = {
url: “http://127.0.0.1:8080/UiPath/service/agent/StartJob”,
method: “POST”,
body: jsonObject,
headers: {“Content-Type”:“text/plain”}
}

[…]

And I launched my request. No error, nothing happens. When I try to launch it with PowerShell, it works :

$job ="{‘WorkflowFile’: ‘C:\…\Main.xaml’, ‘User’: ‘test’, ‘Password’: ‘password’, ‘Type’: 0}"
$jobIdResponse = Invoke-RestMethod -Uri http://127.0.0.1:8080/UiPath/service/agent/StartJob -Body $job -Method Post
$jobId = $jobIdResponse.ChildNodes[0].InnerText

I did everything it says here : https://www.uipath.com/kb-articles/uipath-robot-api

Thanks in advance for the help :slight_smile:


#2

Did you solve your problem? Also do you know whether we can trigger the robot which deployed in Orchestrator?