Hi @tristaanogre,
Sorry I should have been more explicit in what I was describing with the UI. The Web UI leverages the same API. So if you are ever not sure which API Endpoint to call, use your browsers inspector to monitor the requests and perform the actions in the UI to determine the endpoints.
For example when you bring up a Queue Item in the UI, three calls are made
/odata/QueueItemComments/UiPath.Server.Configuration.OData.GetQueueItemCommentsHistory
/odata/QueueItems({key})/UiPathODataSvc.GetItemProcessingHistory
/odata/QueueItemEvents/UiPath.Server.Configuration.OData.GetQueueItemEventsHistory
Looking at UiPath.Server.Configuration.OData.GetQueueItemEventsHistory
It reveals the Robot which processed the queue Item.
{
"@odata.context": "https://<orchestrator>/odata/$metadata#QueueItemEvents",
"@odata.count": 3,
"value": [
{
"QueueItemId": 327194,
"Timestamp": "2021-09-01T21:13:46.69Z",
"Action": "Create",
"Data": null,
"UserId": 126,
"UserName": "user@domain",
"Status": "New",
"ReviewStatus": "None",
"ReviewerUserId": null,
"ReviewerUserName": null,
"Id": 513168
},
{
"QueueItemId": 327194,
"Timestamp": "2021-09-01T21:14:04.377Z",
"Action": "Status",
"Data": null,
"UserId": 217,
"UserName": "K98",
"Status": "InProgress",
"ReviewStatus": "None",
"ReviewerUserId": null,
"ReviewerUserName": null,
"Id": 513169
},
{
"QueueItemId": 327194,
"Timestamp": "2021-09-01T21:14:43.16Z",
"Action": "Edit",
"Data": null,
"UserId": 217,
"UserName": "K98",
"Status": "Successful",
"ReviewStatus": "None",
"ReviewerUserId": null,
"ReviewerUserName": null,
"Id": 513170
}
]
}
From there you can go a few different ways depending on what you expect the state of the job to be in (Completed/Stopped, In Progress)
- Get list of Jobs narrow it based on Robot Name / Timing of when the Queue Item was In Progress
- Use GetRobotDetails will provide you the currentProcess, machineName, etc.
- I’m sure there are other if you explore the https:///swagger
Use the /odata/Jobs
as an example you could pass something similar to
/odata/Jobs?
$expand=Robot
&$filter=((CreationTime ge 2021-09-07T15:15:45.940Z) and (State eq '1') and (Robot/Name eq 'K98'))
&$top=10
&$select=id,robot
- Expand is including the related entity [Robot] details
- Filter is looking for
- CreationTime >= 2021-09-07T15:15:45.940Z
- State == In Progress
- “
Robot/Name
” is looking for a property of a property, the Name of the Robot == “K98”
- Select restricts for the desired properties
{
"@odata.context": "https://<orchestrator>/odata/$metadata#Jobs(Id,Robot,Robot())",
"@odata.count": 1,
"value": [
{
"Id": 363125,
"Robot": {
"LicenseKey": null,
"MachineName": "mymachine",
"MachineId": 98,
"Name": "K98",
"Username": "domain\\user",
"ExternalName": null,
"Description": null,
"Version": "19.10.5.0",
"Type": "NonProduction",
"HostingType": "Standard",
"ProvisionType": "Manual",
"Password": null,
"CredentialStoreId": null,
"UserId": 217,
"Enabled": true,
"CredentialType": null,
"RobotEnvironments": "",
"IsExternalLicensed": false,
"LimitConcurrentExecution": false,
"Id": 199,
"ExecutionSettings": null
}
}
]
}
Hopefully that gives you some ideas!