I’m writing an internal tool and need to check the “Time of Last Scan Attempt” field for all computers that are monitored by BigFix however the API does not appear to expose this field.
Sending a GET request to <BigFix host & port>/api/computer/?fields=Property<Name=Computer%20Name> works fine.
However, this request does not work: <BigFix host & port>/api/computer/?fields=Property<Name=Time%20of%20Last%20Scan%20Attempt>.
Is this field actually exposed by the API? What am I missing?
If you are looking to return a field/property value across all computers (or even a large number of them), it is more efficient to leverage the /api/query method, and pass it some session relevance. Here is a sample session relevance query to return the Computer ID, Name, and Time of Last Scan Attempt across all computers/endpoints in one API call:
(id of it, name of it, value of result from (bes property "Time of Last Scan Attempt") of it | "n/a") of bes computers
Passing this as a url-encoded parameter named ‘relevance’ here is a sample GET request (which will return XML):
So, actually, the order of the response here is in fact guaranteed, and should not change between versions of BigFix. The order of the fields is based on the session relevance query itself, and the fact that it returns a tuple.
That said, you can adjust the output of the query to for instance include field names and concatenate the results into a single row (with definable delimiters) with something like:
(item 0 of it as string & "||" & item 1 of it as string & "||" & item 2 of it as string) of (id of it, name of it, value of result from (bes property "Time of Last Scan Attempt") of it | "n/a") of bes computers
or
("ID:" & item 0 of it as string & "||" & "Name:" & item 1 of it as string & "||" & "LastScanAttempt:" & item 2 of it as string) of (id of it, name of it, value of result from (bes property "Time of Last Scan Attempt") of it | "n/a") of bes computers