Api query action status with machin properties

I need to provide action status, but for each machine, I need to provide an additional property of the machine that was manually assigned. I was tempted to just use the normal API /api/action/{action id}/status, but my customer needs more. I thought about doing an additional query in a loop and updating the outputted XML, but that’s too costly. I know I’m going to butcher this, but in a nutshell, I need at the minimum:

(computer, name
computer custom property X,
action status,
action state,
action start time,
action end time)
of bes computers
whose(action ID of it = “12345”)

I"m at a loss here. Would love some direction. BUMP! :smiley:

Hey Mason,

This should get you started:

(name of computer of it, values of results from (bes property "OS") of computer of it, status of it as string, (start date of action of it & (start time_of_day of action of it & local time zone)) | time issued of action of it, (end date of action of it & (end time_of_day of action of it & local time zone)) as string | "N\A") of results of bes actions whose (id of it = 11740)

We use the action issue time if there is no start defined and we return N\A if the action has no end date.

This returns something like:

TRANSMISSION, Win2016 10.0.14393 (1607), Fixed, ( Tue, 27 Dec 2016 10:24:22 -0600 ), N\A

This works because when we have an action result we can pivot into both the computer object: computer of <result> and back into the action: action of <result> object.

2 Likes

What about for the targeted machines that are " < not reported >" yet?

Targeted computers don’t have results because otherwise they would be reported computers. You can get that list with: (targeted computer set of <bes action>) - (reported computer set of <bes action>) and then list them separately. (or give them default values and include them in the results with the above machines.

So I’m not putting that together properly then.

(
	name of computer of it as string | "Not reported"
	,(value of results from (bes property "SiteCode" ) of computer of it ) | "N\A"
	,status of it as string | "Not Repoted"
	,(start date of action of it & (start time_of_day of action of it & local time zone )) as string | time issued of action of it as string | "N\A"
	,(end date of action of it & (end time_of_day of action of it & local time zone )) as string | "N\A" 
)
//of results of bes actions 
of (targeted computer set of bes action) - (reported computer set of bes action)
whose (id of it = 493080)

@strawgate, the mod of what you put together isn’t quite working the way I thought. Can you tell me what I’m going wrong?

You should have two sections the first one using the relevance I had, the second having a skeleton of the first section with most of the values hardcoded and just listing the targeted computers with whatever property you need.

The other issue is that targeted computer set is only populated if you are using, “Select Devices” or “Enter Device Names”. If you are dynamically targeting all computers will be in the reported computer set.

If you are manually targeting the second portion of your report would be something like:

(name of item 1 of it/*Name of action*/, values of results from (bes property "OS") of item 0 of it, (start date of action of it & (start time_of_day of action of it & local time zone)) | time issued of action of item 1 of it) of
(elements of ((targeted computer set of it) - (reported computer set of it)), it)
of bes actions whose (id of it = 11740)