API Advanced Filters

  • 11 October 2021
  • 4 replies
  • 8 views

I’m looking to search for a device name by using like or contains. I’ve found that using name=PartialName* I can put a * a the end of the term and it works. Using a * at the front of the term results in an error 400.


$FullURI = "https://console.automox.com/api/servers?name=partialname*&o=$orgID"


This page talks about advanced filters for HostName and “like_any” or “not_like_any” but there is no info on where to include that or how the spacing work on the URI if that’s where it goes. It also mentions “display-name” and “contains” or “does-not-contain” with the same issue. Where do these filters go? The body?


4 replies

Userlevel 5

Hey, Mike - I’m not 100% sure myself, and that doc is pretty light, so let me do some digging.

Hi Mike,


Hoping I might be able to shed some light on things. I’m actually in the process of updating the API docs as we speak, as we seem to be lacking some helpful information.


The advanced filters are used in conjunction with our Policies endpoint. You would use them as part of the configuration object, within the request body used when creating or updating a policy, like so (I used mock values in this example):


{
"id": 123, // Include the ID to update an existing policy. It is not required to create a policy.
"name": "My Policy",
"policy_type_name": "patch",
"organization_id": 999999,
"schedule_days": 42,
"schedule_weeks": 20,
"schedule_months": 4680,
"schedule_time": "12:00"
"configuration":
"auto_patch": true,
"notify_user": true,
"auto_reboot": true,
"patch_rule": "advanced",
"advanced_filter": [
{
"left": "display-name",
"right: "the string you're looking for"
"condition": "contains"
}
],
"missed_patch_window": false,
"device_filters_enabled": true,
"device_filters": [
{
"field": "tag",
"op": "in",
"value": [
"Windows",
"Win10"
]
},
{
"field": "hostname",
"op": "like_any",
"value": [
"hostname_A",
"hostname_B"
]
}
],
"include_optional": true,
"notify_reboot_user": true,
"notify_deferred_reboot_user": true,
"custom_notification_patch_message": "Important updates are going to be installed!",
"custom_notification_patch_message_mac": "Important updates are going to be installed!",
"custom_notification_reboot_message": "Reboot needed to finish installing updates!",
"custom_notification_reboot_message_mac": "Reboot needed to finish installing updates!",
"custom_notification_max_delays": 3,
"custom_notification_deferment_periods": [
1,
4,
8
],
"custom_pending_reboot_notification_message": "You will need to reboot!",
"custom_pending_reboot_notification_message_mac": "You will need to reboot!",
"custom_pending_reboot_notification_deferment_periods": [
1,
4,
8
],
"notify_user_message_timeout": 15,
"notify_deferred_reboot_user_message_timeout": 15,
"notify_user_auto_deferral_enabled": true,
"notify_deferred_reboot_user_auto_deferral_enabled": true
},
"notify_user": true,
"server_groups: [
88888,
77777
],
"notes": "Here are some notes"
}

Let me know if you need help with this, or if something isn’t working correctly. Apologies in advance if the above code isn’t formatted correctly. 🙂

Thanks for clarifying. As it only works with the policies endpoint, it doesn’t work for my needs.


My goal is to get a list of deviceIDs by specifying a partial device name with wildcards. The following URI works but I cannot put a * at the front of the partialname without an error code 400


https://console.automox.com/api/servers?name=partialname*&o=$orgID


image001.jpg


image002.png

Hi Mike,


I tried name=test and that looked like it applied a contains statement as it resulted systems starting (test-*) and ending with ‘test’ (*-test).


However when I tried name=test* .

I get what appears to be an additional random system that has no name containing ‘test’.

Reply