How to start robot dynamically with Orchestrator API?

According to Orchestrator API Guide (https://www.uipath.com/hubfs/Documentation/OrchestratorAPIGuide_2016.2/UiPathOrchestratorAPIGuide_2016.2.html#StartJobs) , I can use the following HTTP POST request to start a job. I need to provide both “ReleaseKey” and “RobotIds” to make it work. Question: How can I start a job dynamically without providing a specific “RobotIds”? I tried to replace “Specific” with “Dynamic”. However, it doesn’t work.

{
“startInfo”: {
“ReleaseKey”: “9e16e6a6-f99a-4d2d-b454-93ae02a69ebc”,
“RobotIds”: [
36, 130
],
“NoOfRobots”: 0,
“Strategy”: “Specific”
}
}

Hi,
im not sure about this, but should you not put “NoOfRobots”: 0, to 1 or more?

Thank you for answer, @MickeyFireMouse. I have tried change “NoOfRobots”, but I got an error response message that tells me I cannot set “NoOfRobots” as other numbers when “Strategy” is “Specific”. So I believe we need to change “Strategy” first.

Here is my HTTP Request Body when I set “NoOfRobots” as 2:
http_body = {
“startInfo”: {
“ReleaseKey”: release_key,
“RobotIds”:[robot_id],
“NoOfRobots”: 2,
“Strategy”: “Specific”
}}

Here is the response:
{“message”:“NoOfRobots should be 0”,“errorCode”:0,“resourceIds”:null}

I assume the Strategy is either Specific or Allocate:
image

However, I’m not sure what the exact value would be if it is not “Allocate”

Thank @ClaytonM. Unfortunately, “Allocate” doesn’t work.

{“message”:“Requested value ‘Allocate’ was not found.”,“errorCode”:0,“resourceIds”:null}

You need to pass it as "Strategy":number_of_times_job_should_execute.
Example-

  • "Strategy":1 means run job 1 time.
  • "Strategy":15 means run job 15 times

Read this for more info.

Did you found a solution for this problem?

I’ve tried Strategy:1 and I get a 400 response: “InvalidRobotIDs”

{"startInfo":{"ReleaseKey":"[ReleaseKey]","Strategy":"1","RobotIds":[],"NoOfRobots":0}}

Using Strategy:Specific or a number seems to require a RobotID. Strategy:All appears to be valid, but again, NoOfRobots does not appear to allow anything other than zero. My environment only has one bot running, so I cannot confirm whether Strategy:“All” results in the process running on all bots, or whether it simply runs it dynamically on the next available bot. If anyone could confirm, I’d be grateful. It would be great if the fields were documents, rather than trying to extrapolate from the provided examples.

I’ve found the solution, thanks to some guidance on Bizagi’s website. The strategy needs to be set to RobotCount, and then you can set NoOfRobots. JSON payload looks like this:
{"startInfo":{"ReleaseKey":"[ReleaseKey]","Strategy":"RobotCount","RobotIds":[],"NoOfRobots":1}}

I found the solution here: https://help.bizagi.com/bpm-suite/en/index.html?choosing-a-strategy-for-executi.htm