Software and Approvals

Device filter preview

Generate a preview of the list of devices that match the provided device filter set.

post
policies/device-filters-preview

https://console.automox.com/api/policies/device-filters-preview
Request
Response
Request
Headers
Authorization Bearer
required
string
Your Automox API key for authentication Format: Authorization: Bearer your_automox_api_key
Query Parameters
o
required
integer
The organization ID.
limit
optional
integer
A limit on the number of results to be returned; between 1 and 200 with a default of 25. Use in conjunction with the page parameter.
page
optional
integer
The page of results you want to be returned with page numbers starting at 0. Default: 0 Use in conjunction with the limit parameter.
Body Parameters
device_filters
required
array
A list of device filter objects.
server_groups
required
array
A list of server group IDs for devices that are filtered against. Note: This is an array<int>
Response
200: OK
{
"size”: <total number of devices>,
"results": [
{
"id" : <integer: Device ID>,
"uuid" : <string: Device UUID>,
"name": <string: Device hostname>,
“custom_name”: <string: Device Custom name>”,
“server_group”: <object: Server Group for device>”,
“os_version”: <string: OS Version name>”,
“os_family”: <string: OS Family name>”,
“ip_addr”: <string: Public IP for device>”,
“ip_addrs_prviate”: <string[]: Private IPs for device>”,
“tags”: <string[]: List of tags for the device>
}
...
]
}

Example Requests

cURL
Python http.client
Python requests
C#
PowerShell
cURL
curl --location --request POST 'https://console.automox.com/api/policies/device-filters-preview?o=0000&page=0&limit=25' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer your-automox-api-key' \
--data-raw '{
"device_filters": [
{
"field": "os_family",
"op": "in",
"value": ["Windows"]
}
],
"server_groups": [123456]
}'
Python http.client
import http.client
import json
conn = http.client.HTTPSConnection("console.automox.com")
payload = json.dumps({
"device_filters": [
{
"field": "os_family",
"op": "in",
"value": [
"Windows"
]
}
],
"server_groups": [
123456
]
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer your-automox-api-key'
}
conn.request("POST", "/api/policies/device-filters-preview?o=0000&page=0&limit=25", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Python requests
import requests
import json
url = "https://console.automox.com/api/policies/device-filters-preview?o=0000&page=0&limit=25"
payload = json.dumps({
"device_filters": [
{
"field": "os_family",
"op": "in",
"value": [
"Windows"
]
}
],
"server_groups": [
123456
]
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer your-automox-api-key'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
C#
var client = new RestClient("https://console.automox.com/api/policies/device-filters-preview?o=0000&page=0&limit=25");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer your-automox-api-key");
var body = @"{" + "\n" +
@" ""device_filters"": [ " + "\n" +
@" {" + "\n" +
@" ""field"": ""os_family""," + "\n" +
@" ""op"": ""in""," + "\n" +
@" ""value"": [""Windows""]" + "\n" +
@" } " + "\n" +
@" ]," + "\n" +
@" ""server_groups"": [123456]" + "\n" +
@"}";
request.AddParameter("application/json", body, ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
PowerShell
$apiKey = 'your-automox-api-key'
$headers = @{
"Authorization" = "Bearer $apiKey"
"Content-Type" = "application/json"
}
$url = "https://console.automox.com/api/policies/device-filters-preview?o=0000&page=0&limit=25"
$body = @”
{
"device_filters": [
{
"field": "os_family",
"op": "in",
"value": ["Windows"]
},
{
"field": "hostname",
"op": "like_any",
"value": ["MyWinHost"]
}
],
"server_groups": [123456]
}
”@
$response = (Invoke-WebRequest -Method Post -Uri $url -Headers $headers -Body $body -ContentType "application/json").Content

Available Filters

Field

Supported Operators

Value Type

os_family

in, not in

In, not in: list of strings

os_version_id

in, not in

In, not in: list of strings

ip_addr

like_any, not_like_any

List of strings

tag

like_any, not_like_any

List of strings

hostname

like_any, not_like_any

List of strings