UiPath Automation Cloud has two mechanisms for consuming APIs:
- Getting the API access information from Automation Cloud (described on this page)
- Registering an external application to use the OAuth flow (information and instructions).
Which mechanism to use?
- You can use whichever mechanism you want, but if your Automation Cloud organization uses the Azure Active Directory model, you must register external applications in Automation Cloud and use the OAuth flow.
- Local users, regardless of their organization-level role, can view API access information for Orchestrator services.
How to get API Access information from automation cloud?
- Log in to your Automation Cloud account.
- Navigate to Admin > Tenants. The Tenants page lists all existing tenants.
- Click the arrow on the left of the desired tenant to display its available services.
- Click API Access () for the Orchestrator service. The API Access window opens and includes the following service-specific information:
- User Key - allows you to generate unique login keys to be used with APIs or with 3rd party applications in order to log in and perform actions on your behalf. This was previously known as your refresh token.
- Organization ID - your organization name. It is the name after the base URL (that is, https://cloud.uipath.com/). Learn more about it here.
- Tenant Name - the display name of the tenant.
- Client Id - specific to the Orchestrator application itself, is the same for all users and tenants on a specific platform. For example, all the tenants on cloud.uipath.com have the same Client Id value.
Authenticating to Your Automation Cloud Based Orchestrator Tenant
The authentication operation sends a POST request to https://account.uipath.com/oauth/token. The request and response should look as in the following example:
After which you will get the access token, copy the access token.
Note: Automation Cloud Orchestrator services, the results displayed by the API requests are limited to 1,000 entries for each page. You can use $top and $skip parameters in your requests to retrieve subsequent pages.
For example, use the GET https://cloud.uipath.com/{organization_ID}/{tenant-name}/orchestrator_/odata/RobotLogs?$top=1000&$skip=2000 request to retrieve the robot log entries between 2,001 and 3,000.
How to get the access token?
Method 1: You can use postman (create an account in postman)
- Go to workspace, next in My workspace or create new workspace.
- Click collection (new collection) and click add request.
- Provide oauth token URL (post) and under header provide Content-Type: application/json, X-UiPath-TenantName: {tenant_name}
- Under body (raw) {“grant_type": “refresh_token”, “client_id”: “{client_ID}”, “refresh_token”: “{user_key}”}
- After clicking submit you will get the access token (authorization), copy it.
Method 2: From the studio → download web API package.
- Drag & drop Http Request activity and configure it as shown below (Screenshot provided).
- Go to properties → options → body “{““grant_type”“: “” refresh_token””, ““client_id””: ““{client_ID}””, “”refresh_token””: ““{user_key}””}”
- Store the output response.
Please do check what are the permissions required for endpoint ( click here)
How to perform CRUD operations using orchestrator API’s?
Method 1: Using swagger (2.0)
- Log in to your Automation Cloud account.
- Navigate to Orchestrator and add swagger at the end i.e Base URL + /{organization_name}/{tenant-name}/orchestrator_/ swagger/index.html
- Look for the Authorize button at the top right corner of the Orchestrator API. If the lock is open, you are unauthorized.
- Click Authorize. The Available authorizations window is displayed.
- All scopes are preselected such that you can experiment with all endpoints in the Orchestrator API. Clear them if you want to restrict access to certain APIs.
- Provide Client ID and Click Authorize. A new window is displayed confirming you have been authorized.
- Once done, click Close or X to close the Available authorizations window. The Authorize button shows a closed lock meaning you are authorized.
- While authorized, you can make requests on Orchestrator API resources as follows:
- Expand an Orchestrator API resource with which you want to perform an operation. The closed lock means that you’re authorized.
- In the expanded method window, click Try it out.
- Specify parameter values if required.
- Click Execute. The request is executed. A bearer authorization header is automatically used for your requests.
Method 2: Using postman.
- Go to How to get the access token? , Method 1 and follow the steps for sending requests follow this connection guide to postman API collection (click here)
How to Build a project from studio?
There are two different ways of using Orchestrator API
- Using the Orchestrator HTTP Request Activity (You don’t need additional Auth Mechanism)
- Using the HTTP Request to UiPath.WebApi endpoints using specified credentials.
How to make API Request:
-
Using Orchestrator HTTP Request Activity:
- To use this Robot should be connected to Orchestrator and it does not require to authenticate the Orchestrator using Authenticate API.
- Requires certain role permissions for creating or reading folders, queues etc
- Pass the relative endpoint in the “RelativeEndpoint” like “/odata/Jobs/UiPath.Server.Configuration.OData.StartJobs”
- Refer below link to know more about this:
 https://docs.uipath.com/activities/lang-en/docs/orchestrator-http-request 369
-
Using HTTP Request Activity: (install- UiPath.WebAPI.Activites Package)
-
Robot connectivity with Orchestrator is not required and we need to authenticate the Orchestrator by making HTTP POST request to below API endpoint:
- [Orchestrator Url]/api/Account/Authenticate
-
Its response will return a token, which is stored in the “result” key of the JSON response.
-
The above parameters need to be passed in header, to make HTTP Post Request to Start Jobs API.
-
Note:
- For accessing resources in a folder, each request must contain either the FolderId or FolderPath in an HTTP header. This header may be encoded (using Base64 UTF-16 encoding) or plain text.
- The FolderId can be obtained by performing a GET request to the /odata/Folders endpoint or from the Orchestrator URL -https://cloud.uipath.com/{organization_ID}/{tenant_name}/orchestrator_/?fid=2032&tid=8.|](https://)