Hello everyone,
I am trying to launch my bot after a SQL job has completed and calls a Powershell script. I can get the token, but the syntax on start job is confusing me as I’m not very familiar with PS.
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$postBody = @{startInfo{ReleaseKey=‘ourReleaseKey’;Strategy=‘Specific’;RobotIds=[8];NoOfRobots=0;Source=‘Manual’}}
$headers = @{ContentType=‘application/json’;Authorization=(‘Bearer’ + $token)}
$response = Invoke-WebRequest -Uri https://ourURI.net/odata/Jobs/UiPath.Server.Configuration.OData.StartJobs -Method POST -Body $postBody -Headers $headers | ConvertFrom-Json;
I believe the issue is the double {{}} at startInfo, or maybe the way RobotIds is declared, any guidance is appreciated.
The working JSON looks like this,
{
“startInfo”:
{
“ReleaseKey”:“ourKey”,
“Strategy”:“Specific”,
“RobotIds”:[8],
“NoOfRobots”:“0”,
“Source”:“Manual”
}
}
How do I convert this to PS correctly?