Orchestrator API - How to get values from list of GetJobs via UiPathStudio

Hi,
how can I get all specified values from the API response: list of data collections contained in GetJobs Response in a for each loop?

Response GetJobs is in ODataResponseOfListOfJobDto variable type.

I need to get 4 values from each entry:
"value": [ { "StartTime", "EndTime", "Status", "ReleaseName" }]

For example. The counter for the first case shows 78 results.

I know that I have to do it in a for each loop, but I can’t pass it to the loop in ODataResponseOfListOfJobDto variable type.

I don’t know what type of variable use to convert API Response to process data in loop.

Should I use conversion to a list, to a collection, to array, or maybe to json?

@loginerror, @mike.vansickle

Deserialize JSON would be the best option.

I tried to convert ODataResponseOfListOfJobDto to json format in Deserialize JSON activity, but there were errors.

Please tell us which activity are you using to make the request to get jobs.

I have created custom Library with API request from this link:

Additionaly I.m using UiPath.Web.Activities.

The problem is that this functionality has no documentation.

well that would be impossible for us to help without knowing… :slight_smile: that type does looks like it is a list, so it would work in for each, just adjust the type accordingly, for testing leave as object and in debugger you can see for sure.

I have half a day of failed tests behind me. I will check back tomorrow and send my attempts to the topic.

@bcorrea
Here are the parameters of GetJobs from API custom library:
image

I went deeper and found something like this
After sending a query about the phrase:
getJobsResponse.Value.ToString
I got response

System.Collections.Generic.List'1[UiPathWebApi.JobDto]

JobDto

Represents a scheduled or manual execution of a process on a robot. Supported method: Get.

JobDto Properties from Documentation

https://www.uipath.com/hubfs/Documentation/OrchestratorAPIGuide_2016.2/UiPathOrchestratorAPIGuide_2016.2.html#JobDto

name type nullable Description
Key Edm.Guid false The unique job identifier.
StartTime Edm.DateTimeOffset The date and time when the job execution started or null if the job hasn’t started yet.
EndTime Edm.DateTimeOffset The date and time when the job execution ended or null if the job hasn’t ended yet.
State UiPath.Core.Enums.JobState false The state in which the job is. Possible values: Pending, Running, Canceling, Terminating, Faulted, Successful or Canceled.
Source UiPath.Core.Enums.JobSource false The Source of the job. Possible values: Manual or Schedule.
BatchExecutionKey Edm.Guid false The unique identifier grouping multiple jobs. It is usually generated when the job is created by a schedule.
Info Edm.String Additional information about the current job.
CreationTime Edm.DateTimeOffset false The date and time when the job was created.
Id :key: Edm.Int64 false The database unique identifier.

I made a few requests, here are the results I get:

getJobsResponse.Value.Count.ToString = 0

getJobsResponse.Value(0).Info.ToString = Object reference not set to an instance of an object

getJobsResponse.Value(0).Info.Count.ToString = Object reference not set to an instance of an object

I am not sure but probably this response does not return data. In other respone (Authenticate, GetQueuesDefinitions) I have data.

@bcorrea
Hi,
I found my mistake and solved problem.

Response in GetJobs has NO DATA because I entered the phrase in flow incorrectly on dates when filtering.

It was:

StartTime gt 2020-01-26T23:59:59.00Z and StartTime lt 2020-01-19T00:00:00.00Z and HostMachineName eq ‘PV000xxx’

Should:

StartTime lt 2020-01-26T23:59:59.00Z and StartTime gt 2020-01-19T00:00:00.00Z and HostMachineName eq ‘PV000xxx’

After finding the error, the rest was done quickly.
Below, a shortened flow with key activities:

2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.