OAuth Feature For API Communication Of Orchestrator

Resolution when it is not possible to make an Orchestrator API call with multiple scopes in external application.

Perform the below steps:

Step 1 - Setting up external application in UiPath

To have external application access to your UiPath resources, you need to first configure the application in Orchestrator. For this reason you must have tenant admin access or you can ask you middleware team or admin team , who handles Orchestrator.

  1. Open your Orchestrator and go to admin section and click on "External Application " tab

  1. Click on "Add Applications" then give an application name (Ex- Postman) and selection application type.
  2. Click on "Add scope" then and select Orchestrator API from "resource" drop down.
  3. Select the user scope , in our case since we want our postman to start the Bot in orchestrator, so Postman should have access to (Folders,Robots, Jobs etc) needed resource , click on save.

To know more about application types, scope and about external applications , you can go through this article created by UiPath.

  1. Keep "Redirect URL " anything for now(keep as your Orchestrator URL), but it is an important field. Once you click on Add, it will provide you app ID and App secret keep this separately.
  2. We are done with configuring our external application.

Step 2 - Calling API's from Postman

Follow step by step as represented below.

  1. Create a collection as OAuthUipath--> Select Auth type as OAuth2.0

  1. Input the below fields

  • Token Name - give any token name like Oauth2.0 or anything
  • Grant Type - since we have used postman as confidential application type while configuring up , we need to keep this as Authorization code
  • Auth URL - keep auth url as https://cloud.uipath.com/identity_/connect/authorize
  • Access Toke URL - Keep access token URL as https://cloud.uipath.com/identity_/connect/token
  • Client id and client secret - is nothing but app id and app secret which you have received when you have configured postman in Orchestrator in external application section.
  • Scope - which you have defined in external application scope , go to external application tab in Orchestrator ,click on edit next to user scope to copy scopes and paste here.

if you want to know more about grant type , AUTH URL ,access token URL , how we achieved this , you can go through this doc created by UiPath

  1. Now copy the Callback URL (which you can not change since you are using Postman here)

  1. Go to Orchestrator external application tab, click edit on postman application resource and paste it in "Rediredt URL" where we have added UiPath Orchestrator URL and click on Save.

  1. Click on "Get New access Token" , if everything goes correct ,you should see below screen where you have received the token .

  1. Here our authentication step is competed , we have received the token , we can use received token to do further communication with Orchestrator.

Step 3 - Starting the Bot using OData API

In order to start a bot for a process , Folder name (modern folder name ) is required if you are using , process name for which we want to start the bot .

  1. FolderId is needed from which we can run a process. Folderid can be retrieve using below Get API

Example, for a folder named Zomato in Orchestrator, use below API call to Get FolderId details.

  • 1 - Folder name in Orchestrator
  • 2 - Parameters and Get URI
  • 3 - Headers
  • 4 - Output for Get call - Folder Id here is 424681.
  1. Second, retrieve the process key using process name for which we need to start the bot using below Get API call.
  • In the considered example, process name is "ZomatoFoodReview", use below parameters and headers.

Here key is the id to be used in next Post API call to start the Bot.

  • To start the bot for a above process using key, use below post API call

Provide Tenant name , Organization id(Folder Id) received in first API call and now it should be possible to start the process using available Robot in the folder.

Read more at Accessing UiPath Resources Using External Applications ​​​​​​​.