REST API proper layout

I am using the BigFix API for reporting purposes and I am baffled by the layout of the results.

When I get my results the XML makes no sense…
image

Note how it only uses Result/ Tuple/ Answer so every row looks exactly the same and there is no way to separate field properties or computer. Sot not correct XML.
It should look like this where the value is stored in the property name…

How do I get it to output correctly?

Thanks
Brian

It’s hard to tell based on the screenshots, you’re truncating most of the query. Can you post the actual XML (not just a picture of it), so we can see the query and give some pointers?

@JasonWalker Is the query itself relevant? My issue is the XML returned. If I do a call of any kind to https://bfxServer:52311/api/_**query?relevance=**_ I get the same XML layout as the first picture returned, namely Query>Result and then Tuples and Answers rather than the proper XML returned say when you make a call to :52311/api/computers

The thing is, that this does appear to be a proper XML result to me.

When you query the Computer resource, you are clearly retrieving properties of a computer so the results can be presented as child nodes of a computer result.

Conversely, when you are use the Query resource directly, there’s nothing enforcing a type or parent/child relationship for computers - you could just as easily be retrieving fixlets, actions, operator accounts, or sites rather than computers or properties, so there is no firm parent/child node relationship to be assumed. In fact the answers may not even have Property Names, they could well be combinations of multiple properties or something that isn’t coming from a property at all. Something like <Query Resource="(names of bes computers, &quot;Mary had a little lamb&quot;)"> is perfectly valid but doesn’t have a property name for the second tuple.

How you format the query may make it easier to rearrange and parse the results in whatever programming language you are using, but basically you’ll have multiple “Result” nodes, each potentially having either an “Answer” child or multiple “Tuple” child nodes with each “Tuple” having an “Answer”.

I’m not sure which language you’re using to parse the XML, but you’ll probably have access to properties to iterate through the nodes. In Relevance, you have operators such as first child of <node>, last child of <node>, next sibling of <node>, and previous sibling of <node> as iterators, and I’d expect your language to have something similar.

…in your first post, second screenshot, where everything displays the way you’d like as Result/Computer/PropertyName/PropertyValue - did you hand-build that or did you have an actual result print out that way? I’m not sure I’ve seen that format (but I admit there’s a lot of the API / XML parsing I haven’t encountered yet)