BFI API for software installations by computer

I need to get the software installations for 3,000+ computers from BFI. With no common attribute within BFI for them to be grouped by, I was going to script calling the BFI REST API for each computer and looping through the hostname list, retrieving and storying the results in an output file.

I’m trying to find the endpoint most efficient to do this. I’ve started with “/api/sam/v2/computers” and criteria={“and”:[[“name”,"=",“xxxx”],[“is_deleted”,"=",0]]} but to now add software installation columns, I unfortunately don’t see any associations /api/sam/v2/computers to software_instances.

Which endpoint should I use that can target by computer and include software_installations in the response?

any suggestions on this?
thanks

Are you saying that the list of 3000+ computers in question is arbitrary (and/or changing?)?

I think either way, I would perhaps approach this from the software side (/api/sam/v2/software_instances), and filter on the desired computers with groups (that can be dynamically driven based on properties or other criteria). Here’s an example (url-encoded):

/api/sam/v2/software_instances?criteria={"and":[["computer_group_id","=","1"]]}

the 3000 is a static list right now because it’s the list of servers I need to get the software results from. How would I add 3000 to a (BFI group?) by hostname? They do not have anything in common to group them together by property.

@cstoneba, Is there any property that can be used in BFI to create a computer group for these 3000 computers?

If not, a manual computer group can be created in BigFix by selecting all 3000 and add to manual computer group (may not be the most efficient way).

If the group can be added in BFI then 1 import will be sufficient to recalculate the data for the group.
If the group is added in BigFix then:
1st import will make the computer group available in BFI
Then add the computer group in BFI, based on the Data Source group from BigFix
Run another import to process the data for the group
Create a new user in BFI and assign the computer group to the user
Login as that user and run the /api/sam/v2/software_instances query (from browser or using the user token from an external tool). This will extract the data for the specific group of computers

I was thinking along these same lines. Perhaps you could use the Ad-Hoc Computer Group mechanism in the Console to create a Platform computer group that can then be used to create a BFI computer group.

Yes, those steps sound like they will work. I’m luke-warm about the need for the creation of a group, waiting for an import, deleting the group afterwards, etc.

If I did want to loop through each computer and call the BFI API endpoint for each, which API endpoint would that be?

https://help.hcltechsw.com/bigfix/10.0/inventory/Inventory/integration/r_get_software_instances_v2.html
The software_instances API has both computer_name and computer_id that can be used in criteria to retrieve the data. There is no need to associate with computers api.

it’s taking about 25sec/host which unexpectedly slow. If that is normal I’ll have to go with your first idea of groups.
How much time does it take for you to pull back one endpoints data?

25sec/host seems high. Lot of factors to consider:
No of computers in BFI
Database size
RAM etc
You could try running a query with offset=0&limit=1000&countSwitch=1. This will extract the first 1000 rows and time the query

Hello,

/api/sam/v2/software_instances Gives option to filter by computer attributes. Using criteria and computer ID would be the fastest way to get the data. Example computer related columns are: computer_id,computer_bigfix_id, computer_dns_name, computer_name

So for example for comptuer_id 123456:
/api/sam/v2/software_instances?criteria={"and":+[["is_present",+"=",+"1"],+["is_suppressed",+"=",+"0"],+["computer_id",+"=",+"123456"]]}

To have computer group filtering – create user that has access only to that group and use that user to pull out data from BFI. Then BFI will limit the access to only those computers and then:
/api/sam/v2/software_instances?criteria={"and":+[["is_present",+"=",+"1"],+["is_suppressed",+"=",+"0"]]}

countSwitch will get rid of one extra call to count the number of records. For 3000 computers I would make a single call, so no limit/offset.

What columns are you selecting? Standard set or something extra? Are the index stats up-to-date? Maybe executions plans needs refresh (restart of database or enforcing cleanup of execution plan cache).