Get orchestrator process status and its logs through API

Hi,
Is there any way to check if particular process is running or not in orechestrator and if yes needs to get logs of particular process through API call.

Let us know if this thread helped to achieve your requirement: How to determine Process initiated by UiPath Studio, Assistant (Agent) or Orchestrator? - #2 by marian.platonov

is there any way to get logs of the particular execution of that process?

You can achieve your requirement using the below Rest API calls:

GET for https://cloud.uipath.com/ORG_NAME/TENANT_NAME/orchestrator_/odata/Jobs(ID)?$expand=Release

Response example:

{
    "@odata.context": "https://cloud.uipath.com/ORG_NAME/TENANT_NAME/orchestrator_/odata/$metadata#Jobs(Release())/$entity",
    "Key": "a94327f3-02e1-4024-b8f3-16cd7aa40a21",
    "StartTime": "2022-07-20T14:25:14.787Z",
    "EndTime": "2022-07-20T14:25:39.98Z",
    "State": "Faulted",
    "JobPriority": "Normal",
    "SpecificPriorityValue": 45,
    "Source": "Manual",
    "SourceType": "Manual",
    "BatchExecutionKey": "d649be84-b5d3-470e-bcd3-d09c7d1dfa29",
    "Info": "Error opening workbook. If Excel is installed, run the \u2018Repair Tool for Microsoft Office Interop\u2019 from the Tools tab on the Home screen.\r\n\r\nRemoteException wrapping System.Exception: Error opening workbook. If Excel is installed, run the \u2018Repair Tool for Microsoft Office Interop\u2019 from the Tools tab on the Home screen.  ---> RemoteException wrapping System.UnauthorizedAccessException: Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)). \n   at System.Runtime.Remoting.RemotingServices.AllocateUninitializedObject(RuntimeType objectType)\r\n   at System.Runtime.Remoting.Activation.ActivationServices.CreateInstance(RuntimeType serverType)\r\n   at System.Runtime.Remoting.Activation.ActivationServices.IsCurrentContextOK(RuntimeType serverType, Object[] props, Boolean bNewObj)\r\n   at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)\r\n   at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)\r\n   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)\r\n   at System.Activator.CreateInstance(Type type, Boolean nonPublic)\r\n   at System.Activator.CreateInstance(Type type)\r\n   at UiPath.Excel.Helpers.ExcelInteropHelpers.GetNewComApplication()\n\t--- End of inner exception stack trace ---\n   at UiPath.Core.Activities.UseForegroundScope.OnFaulted(NativeActivityFaultContext faultContext, Exception propagatedException, ActivityInstance propagatedFrom)\r\n   at System.Activities.Runtime.FaultCallbackWrapper.Invoke(NativeActivityFaultContext faultContext, Exception propagatedException, ActivityInstance propagatedFrom)\r\n   at System.Activities.Runtime.FaultCallbackWrapper.FaultWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at UiPath.Executor.BaseRunner.EndExecute(IAsyncResult result)\r\n   at UiPath.Executor.InProcessRunner.EndExecute(IAsyncResult result)\r\n   at UiPath.Core.Activities.ExecutorInvokeActivity.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)\r\n   at System.Activities.AsyncCodeActivity.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext context, IAsyncResult result)\r\n   at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)",
    "CreationTime": "2022-07-20T14:25:14.413Z",
    "StartingScheduleId": null,
    "ReleaseName": "ActionsExample",
    "Type": "Unattended",
    "InputArguments": null,
    "OutputArguments": "{}",
    "HostMachineName": "LAPTOP-***",
    "HasMediaRecorded": false,
    "PersistenceId": null,
    "ResumeVersion": 1,
    "StopStrategy": null,
    "RuntimeType": "Unattended",
    "RequiresUserInteraction": false,
    "ReleaseVersionId": 1437134,
    "EntryPointPath": "Main.xaml",
    "OrganizationUnitId": 2549819,
    "OrganizationUnitFullyQualifiedName": null,
    "Reference": "",
    "ProcessType": "Process",
    "ProfilingOptions": null,
    "ResumeOnSameContext": false,
    "LocalSystemAccount": "NT AUTHORITY\\LOCAL SERVICE",
    "OrchestratorUserIdentity": "robot",
    "Id": 125613658,
    "Release": {
        "Key": "1cdae6e3-f3a4-43b2-b5cb-695fb0394742",
        "ProcessKey": "ActionsExample",
        "ProcessVersion": "",
        "IsLatestVersion": false,
        "IsProcessDeleted": false,
        "Description": "Basic Action Center Example",
        "Name": "ActionsExample",
        "EnvironmentId": null,
        "EnvironmentName": null,
        "EntryPointId": 1333474,
        "InputArguments": null,
        "ProcessType": "Process",
        "SupportsMultipleEntryPoints": true,
        "RequiresUserInteraction": false,
        "IsAttended": false,
        "IsCompiled": false,
        "AutoUpdate": false,
        "FeedId": "c8de13df-3d3f-402c-a694-887f2f00e47c",
        "JobPriority": "Normal",
        "SpecificPriorityValue": 45,
        "OrganizationUnitId": 2549819,
        "OrganizationUnitFullyQualifiedName": null,
        "TargetFramework": "Legacy",
        "RobotSize": null,
        "LastModificationTime": null,
        "LastModifierUserId": null,
        "CreationTime": "2022-07-20T14:13:21.777Z",
        "CreatorUserId": 3842579,
        "Id": 642942,
        "Arguments": null,
        "ProcessSettings": null,
        "Tags": [],
        "ResourceOverwrites": []
    }
}

Then a GET for https://cloud.uipath.com/ORG_NAME/TENANT_NAME/orchestrator_/odata/RobotLogs?$filter=((JobKey%20eq%20a94327f3-02e1-4024-b8f3-16cd7aa40a21)%20and%20(Level%20ge%20%270%27))&$top=50&$orderby=TimeStamp%20desc

Response example:

{
    "@odata.context": "https://cloud.uipath.com/ORG_NAME/TENANT_NAME/orchestrator_/odata/$metadata#RobotLogs",
    "@odata.count": 10,
    "value": [
        {
            "Level": "Info",
            "WindowsIdentity": "NT AUTHORITY\\LOCAL SERVICE",
            "ProcessName": "ActionsExample",
            "TimeStamp": "2022-07-20T14:25:39.752Z",
            "Message": "ActionsExample execution ended",
            "JobKey": "a94327f3-02e1-4024-b8f3-16cd7aa40a21",
            "RawMessage": "{\"message\":\"ActionsExample execution ended\",\"level\":\"Information\",\"logType\":\"Default\",\"timeStamp\":\"2022-07-20T17:25:39.7528066+03:00\",\"fingerprint\":\"9bc5b7de-e145-437c-9738-a8f77cd59b82\",\"windowsIdentity\":\"NT AUTHORITY\\\\LOCAL SERVICE\",\"machineName\":\"LAPTOP-***\",\"fileName\":\"Main\",\"totalExecutionTimeInSeconds\":2,\"totalExecutionTime\":\"00:00:02\",\"processName\":\"ActionsExample\",\"processVersion\":\"1.0.9\",\"jobId\":\"a94327f3-02e1-4024-b8f3-16cd7aa40a21\",\"robotName\":\"robot-unattended\",\"machineId\":1752436,\"organizationUnitId\":2549819}",
            "RobotName": "robot-unattended",
            "HostMachineName": "LAPTOP-***",
            "MachineId": 1752436,
            "RuntimeType": null,
            "Id": 0
        },
...
    ]
}

You can check by yourself the Rest API calls → right-click on the needed Orchestrator page → Inspect → Network → replicate the actions and observe the method calls and their responses.

Let us know if this information helped you.

what would I need to give as JOB ID?

Run a GET for https://cloud.uipath.com/ORG_NAME/TENANT_NAME/orchestrator_/odata/Jobs

and from the results, get the Id. The Id value is the value that you will need in GET for https://cloud.uipath.com/ORG_NAME/TENANT_NAME/orchestrator_/odata/Jobs(Id)

Also, I think that you need to take a look at these documentation materials:

https://docs.uipath.com/orchestrator/reference/jobs-requests

https://docs.uipath.com/orchestrator/reference/building-api-requests