If you’re wondering if Orchestrator has an API you can use to launch automations, then you’ve come to the right place.
This guide describes different UiPath APIs functionalities in Orchestrator, that can be used to build connectors/adapters. The creation of queue items and Start/End jobs in UiPath Orchestrator are frequent uses of these connectors.
APIs functionalities within UiPath
API calls can improve efficiency and performance, reduce execution time and provide more flexibility in automation projects.
In this case, APIs are used to interact with the Orchestrator from any third-party application, even from the UiPath Studio/Robot.
(Source: UiPath)
Basic functionalities which can be achieved through APIs are:
– Start/Stop the Job; The job is the execution of a process on UiPath Robot.
– Check the status of the Robots;
– Create/Modify the Assets;
– Create a queue and push the items into the Queue;
– Check the Status of the Jobs;
– Get the Environment, Process, Robots, Queue, Jobs details.
API – the communication bridge between the bot and set parameters
To communicate with the orchestrator and to use its functionality from the third-party application, we need the Orchestrator API’s, which helps in creating communication bridge both the Applications.
How can you achieve API Integration in UiPath?
In UiPath, we can achieve API Integration by set of activity which is:
1. Orchestrator HTTP Request Activity
– It is used to call UiPath Orchestrator API and allow us to access Orchestrator component, like Robot, Process, Jobs, etc.;
– doesn’t require authentication to use Orchestrator component;
– need to provide “relative endpoint” as input for access any component.
2. HTTP Request Activity
– can be used to call any other endpoint and access the resources of that application
– might need authentication, it depends on that particular application, in order to access the resources of that application
– need to provide absolute request call/endpoint to call an API.
Queue Triggers VIA Orchestrator API
A queue is a list of items that you want to be processed by Robots. When you create a queue in Orchestrator, it is empty. To populate the queue with items, change their status and process them, you have to use activities from Studio.
The Queues page enables you to create queues, view information about queue items (such as average execution time and the total number of successful transactions), display charts with the transaction status progress over time.
By default, the queue items that have been processed successfully are archived on a daily basis, while the others remain in the queue, so that you can decide what to do with them.
How does it work?
Click on the right upper corner of the page: UiPath Connector Guide (Run a postman) and import your calls into your Postman workspace.
Once imported, Postman will require an environment. The creation of a Postman environment is described here. Make calls using the variables listed below.
(source: UiPath)
What about Authentication and Token Refreshing?
You must provide a correct Bearer token authentication when sending API requests to the Orchestrator.
You can retrieve this token using one of the Authenticate methods listed below. For further calls, the token must be added as a Bearer token in the HTTP Header: Authorization property.
There are 2 versions of Orchestrator, with different authentication modes, which I will explain below.
- Automation Cloud
- Latest OnPremises (20.10)
How to Start Process?
Within Orchestrator, a Process that is running or has been run is called a Job.
To start a Job you need to hand over at least the following request body input parameters:
- ReleaseKey: The ID you get in the previous step GET Releases by name. The Orchestator needs this key to run a specific version of a process.
- Strategy: For modern folders we recommend to make use of ModernJobsCount.
- JobsCount: How often the job will be executed.
- InputArguments: If your job has input parameters, they can be sent as a JSON string in the InputArguments field. If it does not, this field will be ignored. See how input arguments are handed over in the next example.
You can Start Process with Data Table Argument:
Process Status and Restart Process
Once a process is started, it will change its status. You might want to wait until a process status is changing to ‘successful’. Once a job has been started, you will receive the job Id. This job Id can be reused to return a job.
How to add queue items?
Queues are a very helpful concept to process data sets. Data sets are called queue items and can be created by calling the AddQueueItem resource.
You can also Get Queue Item by ID:
If you want to create interactive API documentation, you can use Swagger.
Swagger is an open source set of rules, specifications and tools for developing and describing RESTful APIs. Developers can write interactive, machine- and human-readable API documentation using the Swagger framework.
Swagger can generate this information (such as supported operations, parameters and outputs, authorization requirements, available endpoints and licenses needed) automatically from the source code, by asking the API to return a documentation file from its annotations.
Swagger helps users build, document, test and consume RESTful web services. It can be used with both a top-down and bottom-up API development approach. In the top-down, or design-first, method, Swagger can be used to design an API before any code is written. In the bottom-up, or code-first method, Swagger takes the code written for an API and generates the documentation. (Source: TechTarget)
If you have more complex questions, contact the BeeDigital team at: [email protected]