Creating cutom report via REST API

Hi there,

Using relevance, I would like to generate custom report which includes installed patch ids with date respective with computers.

I’ve gone through many documentations and those are not specifying any URL.
when try to find the URL for getting the custom report , I got this URLs (/api/webreports/details,/api/webreports)

Kindly let me know the proper URL and the XML for generating the custom report.

I got to know that from /api/query URL if I mention the relevance then it will work.

I’m trying to right relevance for this ,

but it is keep on failing , in place of computer name I’ve to specify computer name dynamically
Thanks in advance.

I find the Excel Connector very useful to build session relevance that can mimic the filtering abilities in Web Reports. https://developer.bigfix.com/tools/excel_connector.html

1 Like

Thanks SLB. But I’ve to use relevance for the above mentioned filters in my REST API call.
So I’m actually looking for a relevance language for the above condition

The Excel connector will do that for you. You recreate the filters you are using in Web Reports then you can get the session relevance code that will pull that data.

1 Like

Purpose: in computers, to know the installed patches by giving computer name and retrieving some other details associated with fixlet

Due to security reasons, I can’t install that software and almost I got the answer , when I give computer name , it shows it is not defined.

What is missing for me?

‘computer name’ isn’t a property of a fixlet.

You need to be looking at ‘fixlet results’ - https://developer.bigfix.com/relevance/reference/bes-fixlet-result.html

1 Like

I’ve looked into that, but still the same error exists.

This is why I use the Excel connector as it takes away the headache of figure out the joins of different properties, in this case “bes fixlets” and “bes computers” and it constructs an efficient statement that avoid dropped records that follows the brilliant guide written by @brolly33 Efficient Session Relevance Query for Computer Properties

Taking the filters from your original posting, this is session relevance the Excel connector created that you can test this via the Session Relevance Tester or the console Presentation Debugger. This is a statement and Excel knows to interpret “$x$” as a new row so you will still need to tweak it but you should get back the results you are after.

(item 0 of it as string & "$x$" & item 1 of it as string & "$x$" & item 2 of it as string) of ((if (exists Name of Computer of it | false) then (concatenations "%0A" of (Name of Computer of it as string)) else ("<none>")) , (if (exists Category of Fixlet of it | false) then (concatenations "%0A" of (Category of Fixlet of it as string)) else ("<none>")) , (if (exists Name of Fixlet of it | false) then (concatenations "%0A" of (Name of Fixlet of it as string)) else ("<none>"))) of results whose (((Name of Computer of it as string as lowercase contains "yourstring") AND (Category of Fixlet of it as string as lowercase contains "security update") AND (Name of Fixlet of it as string as lowercase contains "windows server 2019"))) of bes fixlets whose ((name of site of it = "Enterprise Security"))

5 Likes

hi SLB,

I’ve tried the same as you’ve given excluding the if condition since that is used in that relevance creator app, it doesn’t throw any error and output also.


It just returned an empty xml in the output.

You may need to % encode certain characters, eg the & ampersands as some characters trigger different behavior when passed over http/https to the REST API. Try replacing any occurrence of “&” with “%26”

2 Likes

I’m actually not using the &, even then it is not giving the result.
This relevance works fine for me.
(name of it,source id of it, source severity of it, source release date of it, source of it, category of it) of bes fixlets whose (category of it as lowercase contains “Security Update” as lowercase AND name of it as lowercase contains “Windows server 2019 - KB” as lowercase)

it is returning windows 2019 patches with name ,source id, source severity, source release date, source and category.

I just need to tweak it a bit so that it returns the patches installed with respective to each computer. I have to add the computer filter in the above relevance. Kindly help to achieve that.

You need to be using ‘bes fixlet results’ to do that - the bes fixlet object just contains information about the fixlet, nothing about where it has installed.

Get the session analysis correct first so it returns the results you need, then look at wrapping it for RestAPI

2 Likes

It might be helpful if you gave a cleared insight as to what you need as your original post suggests you maybe trying to pull the relevant fixlets for one or more computers but now you are referring to seeing the patches installed. You wont be able to gain visibility what patches are installed on an endpoint using the “bes fixlets” or “results of bes fixlets”. You can see computers that are relevant for fixlets via the “results of bes fixlets” as mentioned by @trn though that is accomplished from the code I got from the Excel connector but why that isn’t working for you I can advise on I’m afraid. If you are not using the Session Relevance Tester, I would recommend that as it is a useful tool for building and testing session relevance.

2 Likes

Currently patch management team is manually installing the patches and after patch installation in the web reports they are generating the report for each computer (patches(fixlets) installed on the computers).

I want to automate this using rest api. This is my requirement

(
(
if (exists Name of Computer of it )
then (Name of Computer of it as string)
else (“none”)
) and
(
if (exists Category of Fixlet of it)
then(Category of Fixlet of it as string)
else (“none”)
) and
(
if (exists Name of Fixlet of it )
then (Name of Fixlet of it as string)
else (“none”)
)
)
of results whose
(
(
(Name of Computer of it as string as lowercase contains “computer name”) AND (Category of Fixlet of it as string as lowercase contains “security update”) AND
(Name of Fixlet of it as string as lowercase contains “windows server 2019”)
)
)
of bes fixlets whose ((name of site of it = “Enterprise Security”))

#######################################################################
for the above expression I’m getting “boolean expression is required” as the error