api: Added the ability to list devices by location in the api (#5693)

* Adding location based filter for api-device calls

* I agree to the conditions of the Contributor Agreement contained in doc/General/Contributing.md.

* configured linting etc, now pr should pass

* rebase and add entry to docs
This commit is contained in:
gilrim
2017-02-08 22:57:15 +01:00
committed by Neil Lathwood
parent 8559137587
commit 8b401fd05b
3 changed files with 7 additions and 0 deletions

View File

@@ -210,6 +210,8 @@ function list_devices()
if ($type == 'all' || empty($type)) {
$sql = '1';
} elseif ($type == 'location') {
$sql = "`location` LIKE '%".$query."%'";
} elseif ($type == 'ignored') {
$sql = "`ignore`='1' AND `disabled`='0'";
} elseif ($type == 'up') {