Retrieving a Single Property in a Relevance Statement Called By REST API

Hi all …

I’m taking a look at the BigFix REST API (and relevance expressions).

I have a call that runs a relevance expression that returns all BES properties for a given computer given its computer id, modelled after this. Here’s the call using cURL:

curl -k -X GET --user admin:pwd "https://192.168.x.x:52311/api/query?relevance=((names of it) of properties of it, values of it) of property results of (bes computers whose (id of it = 85713))"

It returns XML of all the properties available, including those from analyses, and it’s the properties fron analyses that I want to examine. Here’s a short snippet of what comes back:

[Tuple]
   [Answer type="string"]Time of Last Successful Scan for Package Data[/Answer]
   [Answer type="string"]2016-03-18 09:15:06 UTC[/Answer]
[/Tuple]
[Tuple]
   [Answer type="string"]Catalog Version</Answer]
   [Answer type="string"]1141854.0</Answer]
[/Tuple]

How can I modify the relevance statement so it just returns a single property, such as “Catalog Version” from my snippet?

–Mark

There are a couple ways to approach this problem using the available inspectors – here is how i’d probably do it assuming the property is unique (a pretty awful assumption…)

You can just use the following inspector:

result from <bes property> of <bes computer>

Example:

value of result from (bes property "OS") of (bes computers whose (id of it = 1020797))

You could also probably put a whose statement in yours:

((names of it) of properties of it, values of it) of ((property results of (bes computers whose (id of it = 1020797))) whose (name of property of it = "OS"))
2 Likes

Perfect! Thanks for the quick answer! --Mark

It doesn’t seem like this is what you are looking for, but just to point out, you can also get all of the results of a particular property this way:

values of results of bes properties "OS"

You can also collapse the duplicate results this way:

unique values of values of results of bes properties "OS"