Run a UiPath Job using Python.

Ishmeet Bindra
2 min readSep 22, 2019

This is a 4 step tutorial explaining how to run a job using Orchestrator API and Python. This tutorial assumes that you know how to connect the UiPath robot to the orchestrator and have set up some process in it.

The response from Orchestrator is in JSON format so we have also used the python’s JSON package to parse it.

Step 1- Get an Authentication Token.

Orchestrator issues temporary bearer tokens which are nothing but some secret value that server issues to identify you. These are short-lived so must be regenerated at regular intervals.

For generating a token you must provide some information so that orchestrator can identify and authenticate you.

Code Snippet #1

Above shown is the minimum information required for you to generate the bearer token. Use the above information and pass it into the following method-

Code Snippet #2

Step 2- Get Process ID.

Process ID (also known as Release Key) is a unique way of identifying any process on orchestrator. We will use the process’s name to identify and retrieve its ID. You just need to pass the name of your process along with the token generated in Step 1 here -

Code Snippet #3

Step 3- Get a Robot ID.

Now we need to identify robot on which we want to run our process. For this, we will use the robot’s name.

Code Snippet #4

Step 4- Run the Bot.

After gathering all the information now we simply run the bot using the following code snippet.

Code Snippet #5

A few things to note here-

Strategy: It defines how we want to run this process. ‘Specific’ means we want to run this process on a specific robot. ‘Dynamic’ means we want to run the process on any of the available bots on the environment.

InputArguments: It defines the input arguments of the process. leave it blank if the process does not have any arguments.

Code and Conclusion.

So this is how we run a bot using Orchestrator API via python. The entire code is down below. Knock yourself out!!!

Code Snippet #6

For more please refer to Orchestrator API Guide.

--

--