BFI API does not return all the computers that are visible in BFI GUI

Hi,

The list of computers in our BFI GUI (no filter applied and it’s consistent with the list in WebReports) has over 1k more computers than the API (using criteria is_deleted=0).

The URLs I use for the comparison:

GUI: https://HOST:PORT/sam/computers
API: https://HOST:PORT/api/sam/v2/computers?token=TOKEN_HERE&criteria={“and”:[[“is_deleted”,“=”,0]]}

The token I use for the API call belongs to the account I use to log in to the GUI, which has administrator role and can see all computers.

What could be the root cause of the API not returning all computers?

Thanks in advance

How do things change if you remove the criteria from the API call?

The list of computers returned has over 500k objects, most of them have “is_deleted”:1. The number of objects that have “is_deleted”:0 is consistent with the number of computers returned when using the criteria {“and”:[[“is_deleted”,“=”,0]]}.

Have there been any custom integrations directly at the database level? I wonder whether it’s possible you have some computers without the ‘is_deleted’ column populated at all?

Try {"and":[["is_deleted","!=",1]]} to query it using the inverse - is_deleted not equal to 1, instead of equal to 0.

Or {"and":[["is_deleted","is_empty"]]} to find any that don’t have is_deleted defined.

edit: I’ve not seen such a condition before and have no reason to suspect it, I’m just speculating on how it might be possible for some of these computers to not match your filter.

No we haven’t done anything directly on the database. And the fact that the GUI shows all the data we expect to see I’d say indicates the data is all there correctly.

I have tried the following two:
{“and”:[[“is_deleted”,“!=”,1]]}: returned the same as {“and”:[[“is_deleted”,“=”,0]]}
{“and”:[[“is_deleted”,“is_empty”]]}: returned 0 computers

1 Like

Ok, thanks for checking. I think you may need to open a Support ticket so the dev team can have a look at it with you.

What count do you get when you run the following API query? https://SERVER:PORT/api/sam/v2/computers?token=TOKEN&countSwitch=2&criteria={“and”: [[“is_deleted”, “=”, “0”]]}

Same as the amount of computers returned when querying without “countSwitch=2”.

The API query defaults to the computer group the user is assigned to. If the GUI user and the API user are same and assigned to “All Computers” then the computer counts should match.

Could you confirm that it’s not the case?
Also do you see computers with valid names in Reports → Computers? Are there any computers with duplicate names or null names?

If all of these check out, then open a support case for further assistance.