How to start a job on specific machine using modern folder via API call?
Follow the steps below:
- In Modern Folder robots are auto provisioned from user. Those data can be found using below API endpoint.
- https://[Orchestrator-URL]/odata/Users
- Get the RobotId mentioned in the response under Unattended Robot.
- Next for getting Machine session Id, follow the steps,
- Call the API - https://[orchestratorUrl]/odata/Machines
- Get all the machines and templates available in Orchestrator with their ID's.
- Copy the Id of the machine template with which the machine Robot is connected and call the other API - https://[orchestratorUrl]/odata/sessions/UiPath.Server.Configuration.OData.GetMachineSessions(key=x) , where x is the Id copied.
- Get all the machines details connected with that template. Now the mentioned Id for the specific machine is the MachineSessionId.
- Now use the below parameters in request body and replace them with required details
{
"startInfo":
{"ReleaseKey":"5044d864-fd5b-498f-a7a6-f63685daaba1",
"RobotIds":[6],
"MachineSessionIds":[4],
"JobsCount":1,
"JobPriority":"Normal",
"Strategy":"ModernJobsCount",
"RuntimeType":"NonProduction",
"InputArguments":"{}"
}}
Note: Change the RuntimeType if there is allocated Unattended Robot.