2017-12-05 Update: Follow these steps to start a robot with a specified job.
Good morning everyone!
I finally decided to post a topic regarding “How to start a robot from Orchestrator by sending API calls”.
I am using CURL via Windows (between %% are my variables):
- First step → Get token: Authentication token:
Run CMD:
C:\Services\CURL\curl.exe --request POST --url https://%orchserver%.com/api/Account/Authenticate --data "{ \ "UsernameOrEmailAddress \ ": \ "%user% \ ", \ "Password \ ": \ "%password% \ “}” --header “Content-Type: application/json” -k -v
=> you need the token
- Step two → Get a list with all robots
Run CMD:
C:\Services\CURL\curl.exe -X GET -H “Authorization: Bearer %TOKEN%” https://%orchserver%.com/odata/Robots -k -v
=>returns a list with each available robot and environment (you will need the robot id which is a static value)
- Step three → Get all releases (all published jobs versions) available on the server:
Run CMD:
C:\Services\CURL\curl.exe -X GET -H “Authorization: Bearer %token%” https://%orchserv%.com/odata/Releases -k -v
=> returns all jobs details (remember that release key changes if you publish a new version)
- Step four → Start Robot (we have token, robot id and release key)
Run CMD:
C:\Services\CURL\curl.exe -X POST -i --url https://%orchserv%.com/odata/Jobs/UiPath.Server.Configuration.OData.StartJobs -H “Content-Type: application/json” -H “Authorization: Bearer %token%” --data "{ \ "startInfo \ ":{ \ "RobotIds \ ":[%robotID%], \ "Strategy \ ": \ "Specific \ ", \ "NoOfRobots \ ":0, \ "Source \ ": \ "Manual \ ", \ "ReleaseKey \ ": \ "%processKey% \ “}}” -k -v
Done!