API call to specific tenant (on-premise)

Hi,

I’m trying to use the Orchestrator API to automatically collect some information from the Orchestrator.
We have an on-premise setup using Windows Authentication and multiple tenants. My user is assigned to all tenants. Sending API calls using the Uipath.Web.Activities.HttpClient activity is working but I’m only ever getting information from one of the tenants. Is it possible to somehow specify which tenant I want to query?

you can use a general http request activity instead of using an orchestrator http request. Then usually you can add the tenant name inside your request body/header.

For that i would recommend checking the swagger documentation of the orchestrator api by adding /swagger behind your orchestrator url

Hi,

according to the Swagger documentation there is no option to specify the tenant. I can specify the folder using X-UIPATH-OrganizationUnitID but not the tenant. I assume it is not possible to specify the tenant in a multi-tenant setup?

@SK1 I guess you can pass the Tenant Name in the Headers Properties of the HTTP Request

ah ok. So may you try splitting it up in several calls. At first do the authentication to get the bearer token. Here you can specify the tenant name. Grab the bearer token and put it into the header of your next api call.

here i posted some example xaml, which i created to start a job via api on orchestrator:

The http header X-UIPATH-TenantName seems to be ignored by the API. No matter what tenant name I enter (existing tenant or not existing tenant), the response is always from the same “standard”-tenant.

As I understand the authenticate endpoint, it is only suitable for local orchestrator users. We are using Windows Authentication for our users. I have tried specifying the windows credentials in the call to the authenticate endpoint but only received the response: “Invalid credentials, failed to login.”.

Well, checking the official documentation once more I found the following statement at API References

image

So I guess when using multiple tenants in combination with windows authentication it is really only possible to query the “first” tenant without an option to specify another tenant.

1 Like

I don’t have multiple tenants to test with, but I am showing the current documentation no longer has this full point.

20.4 - https://docs.uipath.com/orchestrator/v2020.4/reference/api-references

Important!

Starting with 2018.1.3, in Swagger, you can use Windows Authentication to make requests. Previously, you could only make GET requests. POST/PUT/DELETE operations were not supported.

If a user is assigned to more than one tenant, when making requests, the first tenant is always used.

20.10 (Current) - Orchestrator - API References

Important!

Starting with 2018.1.3, in Swagger, you can use Windows Authentication to make requests. Previously, you could only make GET requests. POST/PUT/DELETE operations were not supported.

Maybe worth trying again, or verifying and submitting an edit to the documentation if needed.

Hello,
IN this video I show how to start a process on Process on Premise:

Thanks,
Cristian Negulescu

1 Like

Hi, the way to select tenant with the UiPath activity OrchestratorHttpRequest is to include ?tid=1 or ?tid=4 etc. in the endpoint. The tid (tenant ID) can be obtained from the URL when accessing Orchestrator.

E.g. “/odata/Folders?tid=5”

It does not work like that, it keeps providing the same data regarldes of this parameter

The Orchestrator HTTP request is linked with the robot which is linked to a specific tenant.

The idea behind is that you do not need to provide any user name or password and the API is using the robot link which is set in the UiPath Assistant.

If you are using the UiPath.WebAPI.Activities and use the HTTP request you can make a first call to authenticate to the tenant you would like and then use the bearer to perform the next calls for that specific tenant.

Regards.