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 https://docs.uipath.com/orchestrator/reference/api-references

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) - https://docs.uipath.com/orchestrator/v2020.10/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.

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