Overly Complex Orchestrator Integration

Hi,

Can we have clearer information on our Orchestrators and how to integrate with the Orchestrator API? After much searching i found a post about getting the X-UIPATH-OrganizationUnitId:

I don’t see why one should have to do this to build an integration with the Orchestrator API. This seems like a hack. This is not the only thing that is overly complex about integrating with the API. I feel like we should not have to search through system DBs, look at the calls that our hosted orchestrator Ui’s make, or make additional calls to a API to get basic info needed to build an integration.

Hope to hear from you soon,
Zev

Hello!

Getting X-UIPATH-OrganizationUnitId by inspecting the browser request is just a quick way to solve the problem if you just need that number.

In actual applications, the proper way to do it is by making a GET request to /odata/Folders and looking for the ID of the Folder that you want to use.
Note that you can also use OData clauses to restrict the results. For example, to look for the ID of a Folder named Default, you can use GET /odata/Folders?$filter=FullyQualifiedName eq 'Default'&$select=Id, which would bring back something similar to the following response:

{
  "@odata.context": "https://cloud.uipath.com/[AccountLogicalName]/[TenantLogicalName]/orchestrator_/odata/$metadata#Folders(Id)",
  "@odata.count": 1,
  "value": [
    {
      "Id": 1234
    }
  ]
}

You can find more about building requests on this page: https://docs.uipath.com/orchestrator/reference/building-api-requests

1 Like

Hey @Mateus_Cruz,

Thanks for the quick reply, just to be clear, the X-UIPATH-OrganizationUnitId is the same as a Folder.Id?

Regards,
Zev

Yes, that’s right.
After the introduction of Folders in Orchestrator 2019.10, Organization Units started being called Classic Folders: https://docs.uipath.com/orchestrator/docs/about-folders#folder-types

1 Like

I see it now,

Thank you for your help. Im assuming at some point they will update the header from X-UIPATH-OrganizationUnitId to FolderId.

Orchestrator cannot change or update the header X-UIPATH-OrganizationUnitId in the future because that would break the backwards compatibility with applications/integrations using it.

Instead, there are new headers that can be used as well, which might make more sense now that Organization Units don’t have the same name.
These new headers are X-UIPATH-FolderPath-Encoded and X-UIPATH-FolderPath, detailed at the top of this page: https://docs.uipath.com/orchestrator/reference/building-api-requests

1 Like