diff --git a/includes/html/api_functions.inc.php b/includes/html/api_functions.inc.php
index 4be2a96379..ed4d672824 100644
--- a/includes/html/api_functions.inc.php
+++ b/includes/html/api_functions.inc.php
@@ -1001,7 +1001,7 @@ function add_edit_rule(\Illuminate\Http\Request $request)
if ($device == "-1") {
continue;
}
- $devices[] = ctype_digit($device) ? $device : getidbyname($device);
+ $devices[] = (ctype_digit($device) || is_int($device)) ? $device : getidbyname($device);
}
if (isset($data['builder'])) {