API list_devices update with sysName, location_id and type (#14731)

* Add sysName, location_id, type to list_devices

* Add new list_devices type
This commit is contained in:
Andy Norwood
2022-12-15 14:25:11 +00:00
committed by GitHub
parent f085a5da06
commit d091788f28
2 changed files with 12 additions and 0 deletions

View File

@@ -1014,8 +1014,11 @@ Input:
- ipv4: search by IPv4 address
- ipv6: search by IPv6 address (compressed or uncompressed)
- location: search by location
- location_id: serach by locaiton_id
- hostname: search by hostname
- sysName: search by sysName
- device_id: exact match by device-id
- type: search by device type
- query: If searching by, then this will be used as the input.
Example:

View File

@@ -341,6 +341,15 @@ function list_devices(Illuminate\Http\Request $request)
$sql = 'a.`ipv6_address`=? OR a.`ipv6_compressed`=?';
$select .= ',p.* ';
$param = [$query, $query];
} elseif ($type == 'sysName') {
$sql = '`d`.`sysName`=?';
$param[] = $query;
} elseif ($type == 'location_id') {
$sql = '`d`.`location_id`=?';
$param[] = $query;
} elseif ($type == 'type') {
$sql = '`d`.`type`=?';
$param[] = $query;
} else {
$sql = '1';
}