I’m using the API and I noticed that with the “List Scan Result for Each Host” query (https://docs.flexera.com/csi/api/Content/helplibrary/List_Scan_Result_for_Each_Host.htm#svm_api_completed_scan_3551738620_1219696) only allows us to search by “device_id”. Is there a way we are able to search by device name?
or some way to determine what the "device_id" is from the device name? or would this be an enhancement request?
Sep 06, 2022 02:28 PM
Hi,
To get device id from device name, use the following API. This is "All Hosts" smartgroup API. From the API response, 'nsi_device_id' json node have device id
api/?action=smart_groups&which=getSmartGroupContents&smartGroupTextType=host&smartGroupId=<1>&?_dc=1663230490412&host_name=<Device Name>&page=1&start=0&limit=30&sorters=[{"field":"host_name","direction":"ASC"}]
Pass smartGroupId and host_name as required.
A sample code to get device details from device id is listed here - https://docs.flexera.com/csi/api/Content/helplibrary/Sample_PowerShell_Code_to_Get_Host_Details.htm
Thanks,
Anish Mohan
Sep 15, 2022 03:33 AM
Hi,
To get device id from device name, use the following API. This is "All Hosts" smartgroup API. From the API response, 'nsi_device_id' json node have device id
api/?action=smart_groups&which=getSmartGroupContents&smartGroupTextType=host&smartGroupId=<1>&?_dc=1663230490412&host_name=<Device Name>&page=1&start=0&limit=30&sorters=[{"field":"host_name","direction":"ASC"}]
Pass smartGroupId and host_name as required.
A sample code to get device details from device id is listed here - https://docs.flexera.com/csi/api/Content/helplibrary/Sample_PowerShell_Code_to_Get_Host_Details.htm
Thanks,
Anish Mohan
Sep 15, 2022 03:33 AM