Getting (JobDto) Relations from Orchestrator API

Hi guys!

I am playing around with the API - V.2016.2 - and have reach a some sort of a dead end.

I searching for jobs that have the state “running”, and thereafter extract the information about the robots that are running the job.

I am pulling out jobs via a http request to the API (UiPath Orchestrator API Guide 2016.2), which is going smoothly and free of problems.

According to the API documentation the JobDto has two relations: Release and Robot - which makes absolutly perfect sense.

But how to I access this info?

The way I read the documentation, the json response I recieve from the http request should have a SimpleRobotDto property named “Robot”, but extracting it seems impossible. For example I can do this easy peasy:
json(“State”) but not json(“Robot”) or json(“RobotDto”)

This gives me an error that indicates that the property does not exist.

Is there some REST idea I’m totally missing?

According to the UiPath docs, it should be possible, but doesnt it apply to my version (v.2016.2) ?

Hope someone out there made this work!

Cheers!

I’ve had similar problems - any fix?
Seems really weird that there is a reference to something that you cannot get/use

Hi,

For nested DTOs, you need to expand the OData query, for example:

https://staging.uipath.com/odata/Jobs?$top=2&$expand=Robot,Release

4 Likes

Hi Cristi,

This sounds like a super solution! Can’t wait to get to work and try this out.

Will mark the answer as solved as soon as I have. Thank you so much for the reply!

I was having the same issue. I didn’t find much info on $expand or $filter in the docs but that worked.
Can I $filter on expanded objects?
This example in docs indicates you can (though the syntax seems strange):
https://staging.uipath.com/odata/Sessions?$top=1&$filter=State eq UiPath.Core.Enums.RobotState%27Disconnected%27

I tried the following with no success:
$filter=Robot.MachineName eq UiPath.Application.Dto.RobotDto.MachineName%27VDIRBDEV01%27

Also, can you have compound statements in $filters (e.g., using A “and” B)?
Thanks

The previous example I found in docs was for an enumerated type, not an expanded object.
But this example uses an expanded object and is compound (using an “and”).
https://staging.uipath.com/odata/QueueItems?$top=2&$filter=Robot/Description eq ‘doc_tests’ and Status eq UiPath.Core.Model.Queues.ProcessingStatus%27Failed%27

So it is a strange/undocumented(?) syntax, but this works:
https://myserver.com/odata/Jobs?$filter=State eq ‘Successful’ and Robot/MachineName eq ‘VDIRBDEV01’&$expand=Robot, Release

1 Like

I have since found other defects in the Orchestrator processing of Odata commands. I reported one to UiPath and they only provided me with a workaround (no defect fix), but I did not pursue it because we are on Orchestrator 2016.2 hoping to upgrade to 2018.2 soon (I will report it again it defect still exists in new version).
I found this site helpful in explaining the OData syntax and functionality and noticed this link is in the UiPath 2018.2 API docs:
http://docs.oasis-open.org/odata/odata/v4.0/errata03/os/complete/part1-protocol/odata-v4.0-errata03-os-part1-protocol-complete.html