How to start the job using Orchestrator API?
To start a Job using API, make an HTTP POST request to the below endpoint:
[Orchetsrator URL]/odata/Jobs/UiPath.Server.Configuration.OData.StartJobs
Using the above HTTP POST activity, multiple jobs can be run in different Robots, in one shot.
How to make API Request:
- Using Orchestrator HTTP Request Activity:
- To use this, the Robot should be connected to Orchestrator and it does not require authenticating the Orchestrator using Authenticate API.
- Pass the relative endpoint in the "RelativeEndpoint" like "/odata/Jobs/UiPath.Server.Configuration.OData.StartJobs"
- Refer to below link to learn more about this:
- Using HTTP Request Activity:
- Robot connectivity with Orchestrator is not required and authentication the Orchestrator is needed by making an HTTP POST request to below API endpoint:
- [Orchestrator Url]/api/Account/Authenticate
- Its response will return a token, which is stored in the "result" key of the JSON response
- The above parameters need to be passed in the header, to make HTTP Post Request to Start Jobs API.
- Robot connectivity with Orchestrator is not required and authentication the Orchestrator is needed by making an HTTP POST request to below API endpoint:
Description of Payload or Body :
Below is the format,with dummy data of the payload that is needed to pass while making an HTTP Post request to Start Jobs API
{
"startInfo": {
"ReleaseKey": "3821CA918-C153-4995-8218-B5VA2C79694429",
"Strategy":"Specific",
"RobotIds": [6],
"NoOfRobots": 0,
'"JobsCount":0,
"Source":" Manual",
"InputArguments":"{'id': '1', 'table_id': 'AAA'}"
}
}
Release Key: It is the Unique key for the process that needs to be run. To fetch the release key of the process, the HTTP GET request to below API EndPoint is needed:
[Orchestrator URL]/odata/Releases
The above request will return the data for all the processes created . This can be used to fetch the release wrt to the required process name and then pass it to the Start Job API.
Or
Make use of [Orchestrator URL]/odata/Releases(ID) to get the specific release ID, with respect to the ID of the Process name.
Strategy –States which Robots from the environment are being run by the process.= ['All', 'Specific', 'RobotCount', 'JobsCount']
- ‘All’: It will start the job for all the robots present under the associated environment.
- ‘Specific’: Using this, the job can be run on a specific robot, and the robot ID needs to be passed in the "RobotIds" array.
- ‘RobotCount’: This is deprecated. Do not use.
NoofRobots: Deprecated
InputArguments::Input parameters in JSON format to be passed to job execution.
Refer to this link for more details: Jobs Requests