Hello Community,
I want to share with you a easy way to use Orchestrator APIs in UiPath. If you are not familiar with Orchestrator APIs, please go to Swagger website. Accesing Swagger you will find all available orchestrator APIs.
In order to access Swagger, please identify if you are using on-promise orchestrator or clould version.
-
on-premise - add the following suffix: /swagger/index.html to your
Orchestrator URL. For
example, https://myOrchestrator.com//swagger/index.html. -
Automation Cloud - add the account and tenant name, as well as
the /swagger/index.html suffix to the URL. For
example, UiPath
Swagger View: Display List of Available Orchestrator APIS:
In Swagger, you will be able to execute all APIs available, check APIs documentation, check input parameters (optionals & required) and know output result structure in json or xml format.
As example, get QueueItems for 441296 Queue definition id and limit top as 1
API Response View from Swagger:
Now that we are familiar with all available Orchestrator operations using Swagger, it is highly important verify your access to the APIs in Orchestrator. One initial required information is find our Account Logical Name and Tenant Name
You can find it, following bellow steps:
- Go to Orchestrator Admin Section
- Click into Tenants Option
- Display more option for your Tenant
- Click API Access (Cloud Icon)
You can execution the APIs using different tools and techbologies for example Postman or using Axios packages in your Nodejs application, for this example we will use UiPath Automation to execute the Orchestrator API using the UiPath package UiPath.Activities.API
Before you executing desired API, you may invoke API Authentication to retrieve access token, this token will be used in the others API call as part of the body.
In order to retrieve your access token, you need to request a POST in the following End Point:
*https://account.uipath.com/oauth/token*
*Specified Tenant Name in Headers (X-UIPATH-TenantName). Use your client id and user key from previous step.
Here is an example of implementation using UiPath Studio:
-
Use HTTP Request activity, specified Accept format as application/json, use
https://account.uipath.com/oauth/token as end point, select Post Method. Retrieve outputs from activity Headers, Result and Status Code
-
Create Body request in String variable and use in request body field
parameter.
-
Check if status code = 200, deserialize json using UiPath Activity
and extract [access_token] from json response.
-
For any API Call, use your [access token] in Header section
For example, “Get Queue Ids”
UiPath
Get Queue Data
-
Using Skip
Community edition have a limitation retrieve 1000 transaction per Get Request, in
order to get all data, you can use skip flag and increase by 1000 until get all your data.
- Without Skip
UiPath)&$expand=Robot,ReviewerUser&$orderby=Id%20desc
UiPath Implementation: