So I have an application that triggers process through api “UiPath.Server.Configuration.OData.StartJobs”.
X-UIPATH-OrganizationUnitId is required in the header which is the folder Id of the released process.
For some reason the folder Id changes itself from 2500716 to 16230 today, which causes all the api calls to not work with error “Folder does not exist or the user does not have access to the folder”.
Any reason why the folder Id in orchestrator changes itself without any modification on my side?
I can’t speak to why the Folder ID change, perhaps due to an update to the Cloud Environment.
What I would suggest to protect yourself against changes in references to unique IDs that you don’t control, is instead of passing the header X-UIPATH-OrganizationUnitId to pass the X-UIPATH-FolderPath header, if the Folder is known upfront.
Alternatively if you don’t know the exact path of the folder (and this applies to other resources too e.g. Robots) is to request for the Folder Name/Path or ID using /odata/Folders first than pass the desired reference in future requests.
For accessing resources in a folder, each request must contain either the FolderId, FolderPath, or FolderKey in an HTTP header. This header may be encoded (using Base64 UTF-16LE encoding) or plain text.
X-UIPATH-FolderPath "PlainText FolderPath value", or
X-UIPATH-FolderKey "FolderKey".
The FolderId can be obtained by performing a GET request to the /odata/Folders endpoint and copying the “Id” value, or from the Orchestrator URL - https://your-domain-server.com/?fid=2032&tid=8. FolderId is of type Int 64.
The FolderKey can be obtained by performing a GET request to the /odata/Folders endpoint and copying the “Key” value. FolderKey is of type Unique Id/String.
If you change the licensing plan for your Orchestrator account (for example, from Enterprise Trial to Enterprise), the FolderId value also changes, whereas the FolderKey value remains the same.
If you upgraded and had Organization Units enabled in your previous Orchestrator instance, each OU is migrated as a new Classic folder.
Relative folder paths are supported in an X-UIPATH-FolderPath-Encoded header, as follows:
Path starting with / - starts from the root folder of the tree the ambient folder is part of.
Path starting with . - starts from the ambient folder.
Path starting with .. - starts one level up in the hierarchy of the ambient folder for each .. in the path (e.g. ../ for one level up, ../../ for two levels up in the hierarchy).