API GET Robots

I am sending a request to get all robots for a given tenant along with the OU/Folder ID. The folder ID is a required header for this API which I don’t understand as robots are created at the tenant level. When I send the request, I get an HTTP 200 but I get a response indicating an empty collection:
{
@odata.context”: “https://cloud.uipath.com/[acct]/[tenant]/orchestrator_/odata/$metadata#Robots”,
@odata.count”: 0,
“value”:
}
For this tenant, there are 9 robots which I can see through Orchestrator at the tenant level.

On this tenant, I only have access to one folder although there are at least a dozen folders including Default and Shared. I am passing the ID of the one folder I have access to.

I assume I have the correct permissions of Robot.View as I can see the robots in Orchestrator. I’m also a Tenant Administrator and a Folder Administrator for the folder ID I am passing in the HTTP header.

What am I missing here? Why is a Folder ID/OU required to get all robots through the API?

@Randy_Fuller
Hello,
1 - Install the UiPath.Web.Activities library

2 - Use the ‘HTTP from Orchestrator’ activity

3 - If the computer from which it will be run, is already added to the orchestrator, just enter the following path “/ odata / Robots”

api_1
api_2
api_orchestrator.xaml (6.3 KB)

Thanks for the reply but whether I execute the API call using the robot or Postman, I get the same empty collection. I just tested making the call using a test workflow as you’ve described here and I get the same results as I get when calling the API in Postman. However, executing the GET against the /odata/Robots resource using this activity doesn’t require a folder/OU identifier to be passed in so I’m assuming it is passing in the Default folder ID.

Whether I call the API with Postman or with the Orchestrator HTTP Request activity, I get an empty collection even though I can view the list of robots in Orchestrator.

yes, my robots are in the default folder, do you have another folder created in the orchestrator?

Yes. We have multiple folders depending on the project.

The behavior of that Orchestrator HTTP Activity is that it passes the first folder in the list of folders the robot account has permissions to. I’ve tried several alternatives such as passing in the ID in the query string but the header X-UIPATH-OrganizationUnitId is the value used.

The Orchestrator HTTP Activity works fine for calls not requiring a folder ID or if there is only 1 folder. However, calling the API for a list of jobs or queues that require a specific FolderID, this activity does not work as it always passes the same value in the X-UIPATH-OrganizationUnitId.

Use only, “/odata/”,
this should return you content. otherwise there is a block on your network, it can be a proxy or something similar.

if you edit the user’s permissions on the orchestrator, you can view the other folders, add administrator permission.

alter_tenant_2

Folders: Default, Teste

@Randy_Fuller You can retrive the Robot information according to its ID, NAME, STATUS, SPECIFIC PROCESS…
Refer this
https://docs.uipath.com/orchestrator/reference/about-odata-and-references
https://docs.uipath.com/orchestrator/reference/robots-requests

I’ll review this documentation again and give it a try.

Except for the call to get all robots for a tenant and get all job triggers for a folder, I have all the API calls I need working in Postman. It would be ideal if the Orchestrator HTTP Request activity could be used but there’s no property to input a Folder/OU ID.

Refer This

That’s what I’m using for all my API tests. I have several environments set up to connect to different Automation Cloud logical accounts.

The issue is not with how to make the API call or how does it work. The issue is the call to get all robots does not return all robots regardless of what Folder ID is passed in. My account is tenant admin so permissions are all good.

It appears that the only robots returned in the API are robots that are not automatically created for UiPath Studio developer license. Of 5 robots I see in Orchestrator, only 1 is returned by the API call to /odata/Robots. The robot returned in the call is an unattended robot not created automatically as attended for a Studio license.

The following image is from Orchestrator robots view. The only robot returned by my API call is outlined in red.

Using the activity “Orchestrator HTTP Request” you can make calls only to UIPath Orchestrator API.
Call to /odata/Robots —Returns only a Robot Info that is authenticted under a robot it is executed on.
Use “HTTP Request” activity —> Steps → Authenticate–GetLicense–Get Robots.

If possible I will upload workflow for the same.

Problem solved:

I contacted UiPath support as I know there must be an API request that will return a list of robots as that list is presented in Orchestrator. I also was aware that there is a difference in robots provisioned as “modern” versus robots provisioned as “classic”.

My original API request is formatted per documentation and is sent with the HTTP header X-UiPath-OrganizationalUnitId set to a valid folder ID as follows:
https://cloud.uipath.com/[acct]/[tenant]/odata/Robots
This returns only the 1 classic provisioned robot in the list shown in my previous post when sent with the Default folder ID.

The API request suggested by Vikash at UiPath support is as follows:
https://cloud.uipath.com/[acct]/[tenant]/odata/Sessions/UiPath.Server.Configuration.OData.GetGlobalSessions?$expand=Robot($expand=License)
This request returns all robots provisioned on the tenant as seen from the Orchestrator list in my previous post. Also, this request does not require the X-UiPath-OrganizationalUnitId header to be sent.

As I understand this request and the OData parameters passed, this query is pulling back the RobotLicenseDto and the RobotWithLicenseDto by way of the SessionDto. It is my assumption this seemingly obtuse method is due to some behind the scene changes in regards to modern folders and how robots are provisioned. Nevertheless, I have the list of robots I need.

Randy

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.