Update a policy

Updates a policy object.

put
/policies/{id}

https://console.automox.com/api/policies/{id}
Request
Response
Request
Path Parameters
id
required
integer
Policy ID for the specified policy
Headers
Content-Type: application/json
required
string
Specify json as the content type for body parameters
Authorization: Bearer
required
string
Your Automox API Key for authentication Format: Authorization: Bearer your_automox_api_key
Query Parameters
o
required
integer
Organization ID for the specified policy
Body Parameters
name
required
string
Name of the policy
policy_type_name
required
string
Name for the policy type. Possible values: patch: Patch Policy custom: Worklet (formerly Custom Policy) required_software: Required Software Policy
organization_id
required
string
Organization ID for the specified policy
schedule_days
required
integer
Decimal value of binary day schedule See Note: Schedules
schedule_weeks_of_month
required
integer
Decimal value of binary week schedule See Note: Schedules
schedule_months
required
integer
Decimal value of binary month schedule See Note: Schedules
schedule_time
required
string
Scheduled time for automatic policy execution Format: "hh:mm"
notes
optional
string
Policy notes
server_groups
optional
array
Integer array Server groups to link with the policy See Example Body
configuration
required
object
Configuration is a full object containing all of the following parameters See Example Body
auto_patch
optional
boolean
Enable or Disable automatic execution of the policy
auto_reboot
optional
boolean
Enable or Disable automatic reboots following policy execution
notify_user
required
boolean
Display notification 15 minutes before patching
notify_reboot_user
optional
boolean
Display modified notification 15 minutes before patching. This message should inform the user that a reboot will follow patching actions
missed_patch_window
optional
boolean
Enable or Disable Missed Patch Window setting
patch_rule
optional
string
Use only with Patch Policy. Possible values: all: Patch All filter: Patch All Except or Patch Only or Patch by Severity manual: Manually Approve advanced: Advanced Patch Policy (beta)
filter_type
optional
string
Use only with patch_rule of filter. Possible values: exclude: Patch All Except include: Patch Only severity: Patch by Severity
filters
optional
array
String array. Use only with filter_type of exclude or include. Use (*) for wildcard. See Example Body
severity_filter
optional
array
String array. Use only with filter_type of severity. Defines severity ratings to include in patching Format: ["low","medium","high","critical","none","unknown"]
advanced_filter
optional
array
Object array. Include one object per advanced filter line. See Note: Advanced Filter
include_optional
optional
boolean
Enable or disable inclusion of optional Windows patches for this policy. NOTE: Will default to false if not included.
custom_notification_max_delays
optional
integer
Custom Notifications Beta Feature Number of deferral chances before patching is forced.
custom_notification_deferment_periods
optional
array
Custom Notifications Beta Feature Integer array: Deferral time periods (hours) that users can choose from. Include up to 3. All 3 must be distinct with a maximum of 24 Format: [1, 4, 8]
custom_notification_patch_message
optional
string
Custom Notifications Beta Feature Message to display before a non-rebooting patch policy executes on a Windows device Maximum 125 characters
custom_notification_reboot_message
optional
string
Custom Notifications Beta Feature Message to display before a rebooting patch policy executes on a Windows device. Reboot will follow patching actions. Maximum 125 characters
custom_notification_patch_message_mac
optional
string
Custom Notifications Beta Feature Message to display before a non-rebooting patch policy executes on a macOS device. Maximum 70 characters
custom_notification_reboot_message_mac
optional
string
Custom Notifications Beta Feature Message to display before a rebooting patch policy executes on a macOS device. Reboot will follow patching actions. Maximum 70 characters
Response
200: OK
{
"type": "object",
"required": [
"name",
"organization_id",
"policy_type_name",
"schedule_days",
"schedule_time",
"configuration",
"notes"
],
"properties": {
"configuration": {
"type": "object",
"required": [
"auto_patch",
"auto_reboot"
],
"properties": {
"auto_patch": {
"type": "boolean"
},
"auto_reboot": {
"type": "boolean"
},
"installation_code": {
"type": "string"
},
"os_family": {
"type": "string"
},
"package_name": {
"type": "string"
},
"evaluation_code": {
"type": "string"
},
"remediation_code": {
"type": "string"
},
"test_code": {
"type": "string"
}
}
},
"create_time": {
"type": "string",
"format": "date-time"
},
"id": {
"type": "integer",
"format": "int64"
},
"name": {
"type": "string"
},
"notes": {
"type": "string"
},
"organization_id": {
"type": "integer",
"format": "int64"
},
"policy_type_name": {
"type": "string"
},
"schedule_days": {
"type": "integer",
"format": "int64"
},
"schedule_time": {
"type": "string"
}
}
}

Example JSON Patch Policy Object Body

{
"name": "Modified Name",
"policy_type_name": "patch",
"organization_id": 0000,
"configuration": {
"auto_patch": false,
"auto_reboot": true,
"notify_reboot_user": true,
"notify_user": true,
"missed_patch_window": true,
"patch_rule": "advanced",
"filters": ["*KB2267602*","*Exclude This Too*"],
"severity_filter": ["low","medium","high","critical","none","unknown"],
"include_optional": false,
"custom_notification_patch_message": "MODIFIED Notification Text before normal patch - Windows - Max 125 Char",
"custom_notification_reboot_message": "Notification Text before reboot patch - Windows - Max 125 Char",
"custom_notification_patch_message_mac": "Notification Text before normal patch - Mac - Max 70 Char",
"custom_notification_reboot_message_mac": "Notification Text before reboot patch - Mac - Max 70 Char",
"custom_notification_max_delays": 3,
"custom_notification_deferment_periods": [1, 4, 8],
"advanced_filter": [
{
"left": "patch-source",
"right": "windowsupdate",
"condition": "is"
},
{
"left": "severity",
"right": "medium",
"condition": "greater-than-or-equal-to"
}
]
},
"schedule_days": 146,
"schedule_weeks_of_month": 42,
"schedule_months": 4162,
"schedule_time": "01:00",
"notes": "Patch every Mon,Thu,Fri\n1st,3rd,5th Week\nJan,Jun,Dec",
"create_time": "2019-09-20T21:16:34+0000",
"server_groups": [23500]
}

This example show each filter type included. Include and Exclude will use "filters". Severity will use "severity_filter". Advanced will use "advanced_filter".

Note: Schedules

Policy schedules are the decimal value of a binary representation of True/False for each day/week/month.

Example days per week:

For scheduling days of the week there will be 7 digits with a trailing zero to mark the end. This starts on Sunday and ends on Monday. 1 represents ON and 0 represents OFF for each day of the week.

Sun|Sat|Fri|Thu|Wed|Tue|Mon|TrailingZero

Every Day: 11111110 = 254

Mon/Wed/Fri only: 00101010 = 42

Example weeks per month:

Weeks are scheduled similarly to days, except there are 5 digits with a trailing zero. This starts on the 5th week of the month and ends with the 1st week of the month.

5th|4th|3rd|2nd|1st|TrailingZero

Every Week: 111110 = 62

2nd/4th weeks only: 010100 = 20

Example months per year:

Months continue the trend with 12 digits with a trailing zero. Starting with December and ending with January.

Dec|Nov|Oct|Sep|Aug|Jul|Jun|May|Apr|Mar|Feb|Jan|TrailingZero

Every Month: 1111111111110 = 8190

Mar/Jun/Sep/Dec = 1001001001000 = 4680

Example Requests

cURL
Python http.client
Python requests
C#
PowerShell
cURL
curl -X PUT \
'https://console.automox.com/api/policies/12345?o=0000' \
-H 'Authorization: Bearer your_automox_api_key' \
-H 'Content-Type: application/json' \
-d '{
"name": "Modified Name",
"policy_type_name": "patch",
"organization_id": 0000,
"configuration": {
"auto_patch": false,
"auto_reboot": true,
"notify_reboot_user": true,
"notify_user": true,
"missed_patch_window": true,
"patch_rule": "advanced",
"filters": ["*KB2267602*","*Exclude This Too*"],
"severity_filter": ["low","medium","high","critical","none","unknown"],
"include_optional": true,
"custom_notification_patch_message": "MODIFIED Notification Text before normal patch - Windows - Max 125 Char",
"custom_notification_reboot_message": "Notification Text before reboot patch - Windows - Max 125 Char",
"custom_notification_patch_message_mac": "Notification Text before normal patch - Mac - Max 70 Char",
"custom_notification_reboot_message_mac": "Notification Text before reboot patch - Mac - Max 70 Char",
"custom_notification_max_delays": 3,
"custom_notification_deferment_periods": [1, 4, 8],
"advanced_filter": [
{
"left": "patch-source",
"right": "windowsupdate",
"condition": "is"
},
{
"left": "severity",
"right": "medium",
"condition": "greater-than-or-equal-to"
}
]
},
"schedule_days": 146,
"schedule_weeks_of_month": 42,
"schedule_months": 4162,
"schedule_time": "01:00",
"notes": "Patch every Mon,Thu,Fri\n1st,3rd,5th Week\nJan,Jun,Dec",
"server_groups": [23500]
}'
Python http.client
import http.client
conn = http.client.HTTPConnection("console,automox,com")
payload = "{\r\n\t\"name\": \"Modified Name\",\r\n\t\"policy_type_name\": \"patch\",\r\n\t\"organization_id\": 0000,\r\n\t\"configuration\": {\r\n\t\t\"auto_patch\": false,\r\n\t\t\"auto_reboot\": true,\r\n\t\t\"notify_reboot_user\": true,\r\n\t\t\"notify_user\": true,\r\n\t\t\"missed_patch_window\": true,\r\n\t\t\"patch_rule\": \"advanced\",\r\n\t\t\"filters\": [\"*KB2267602*\",\"*Exclude This Too*\"],\r\n\t\t\"severity_filter\": [\”low\",\"medium\",\"high\",\"critical\”,\”none\”,\"unknown\”],\r\n\t\t\"include_optional\": true,\r\n\t\t\"custom_notification_patch_message\": \"MODIFIED Notification Text before normal patch - Windows - Max 125 Char\",\r\n\t\t\"custom_notification_reboot_message\": \"Notification Text before reboot patch - Windows - Max 125 Char\",\r\n\t\t\"custom_notification_patch_message_mac\": \"Notification Text before normal patch - Mac - Max 70 Char\",\r\n\t\t\"custom_notification_reboot_message_mac\": \"Notification Text before reboot patch - Mac - Max 70 Char\",\r\n\t\t\"custom_notification_max_delays\": 3,\r\n\t\t\"custom_notification_deferment_periods\": [1, 4, 8],\r\n\t\t\"advanced_filter\": [\r\n {\r\n \"left\": \"patch-source\",\r\n \"right\": \"windowsupdate\",\r\n \"condition\": \"is\"\r\n },\r\n {\r\n \"left\": \"severity\",\r\n \"right\": \"medium\",\r\n \"condition\": \"greater-than-or-equal-to\"\r\n }\r\n ]\r\n\t},\r\n\t\"schedule_days\": 146,\r\n\t\"schedule_weeks_of_month\": 42,\r\n\t\"schedule_months\": 4162,\r\n\t\"schedule_time\": \"01:00\",\r\n\t\"notes\": \"Patch every Mon,Thu,Fri\\n1st,3rd,5th Week\\nJan,Jun,Dec\",\r\n\t\"server_groups\": [23500]\r\n}"
headers = {
'Content-Type': "application/json",
'Authorization': "Bearer your_automox_api_key"
}
conn.request("PUT", "api,policies,12345", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Python requests
import requests
url = "https://console.automox.com/api/policies/12345"
querystring = {"o":"0000"}
payload = "{\r\n\t\"name\": \"Modified Name\",\r\n\t\"policy_type_name\": \"patch\",\r\n\t\"organization_id\": 0000,\r\n\t\"configuration\": {\r\n\t\t\"auto_patch\": false,\r\n\t\t\"auto_reboot\": true,\r\n\t\t\"notify_reboot_user\": true,\r\n\t\t\"notify_user\": true,\r\n\t\t\"missed_patch_window\": true,\r\n\t\t\"patch_rule\": \"advanced\",\r\n\t\t\"filters\": [\"*KB2267602*\",\"*Exclude This Too*\"],\r\n\t\t\"severity_filter\": [\”low\",\"medium\",\"high\",\"critical\”,\”none\”,\"unknown\”],\r\n\t\t\"include_optional\": true,\r\n\t\t\"custom_notification_patch_message\": \"MODIFIED Notification Text before normal patch - Windows - Max 125 Char\",\r\n\t\t\"custom_notification_reboot_message\": \"Notification Text before reboot patch - Windows - Max 125 Char\",\r\n\t\t\"custom_notification_patch_message_mac\": \"Notification Text before normal patch - Mac - Max 70 Char\",\r\n\t\t\"custom_notification_reboot_message_mac\": \"Notification Text before reboot patch - Mac - Max 70 Char\",\r\n\t\t\"custom_notification_max_delays\": 3,\r\n\t\t\"custom_notification_deferment_periods\": [1, 4, 8],\r\n\t\t\"advanced_filter\": [\r\n {\r\n \"left\": \"patch-source\",\r\n \"right\": \"windowsupdate\",\r\n \"condition\": \"is\"\r\n },\r\n {\r\n \"left\": \"severity\",\r\n \"right\": \"medium\",\r\n \"condition\": \"greater-than-or-equal-to\"\r\n }\r\n ]\r\n\t},\r\n\t\"schedule_days\": 146,\r\n\t\"schedule_weeks_of_month\": 42,\r\n\t\"schedule_months\": 4162,\r\n\t\"schedule_time\": \"01:00\",\r\n\t\"notes\": \"Patch every Mon,Thu,Fri\\n1st,3rd,5th Week\\nJan,Jun,Dec\",\r\n\t\"server_groups\": [23500]\r\n}"
headers = {
'Content-Type': "application/json",
'Authorization': "Bearer your_automox_api_key"
}
response = requests.request("PUT", url, data=payload, headers=headers, params=querystring)
print(response.text)
C#
var client = new RestClient("https://console.automox.com/api/policies/12345?o=0000");
var request = new RestRequest(Method.PUT);
request.AddHeader("Authorization", "Bearer your_automox_api_key");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("undefined", "{\r\n\t\"name\": \"Modified Name\",\r\n\t\"policy_type_name\": \"patch\",\r\n\t\"organization_id\": 0000,\r\n\t\"configuration\": {\r\n\t\t\"auto_patch\": false,\r\n\t\t\"auto_reboot\": true,\r\n\t\t\"notify_reboot_user\": true,\r\n\t\t\"notify_user\": true,\r\n\t\t\"missed_patch_window\": true,\r\n\t\t\"patch_rule\": \"advanced\",\r\n\t\t\"filters\": [\"*KB2267602*\",\"*Exclude This Too*\"],\r\n\t\t\"severity_filter\": [\”low\",\"medium\",\"high\",\"critical\”,\”none\”,\"unknown\”],\r\n\t\t\"include_optional\": true,\r\n\t\t\"custom_notification_patch_message\": \"MODIFIED Notification Text before normal patch - Windows - Max 125 Char\",\r\n\t\t\"custom_notification_reboot_message\": \"Notification Text before reboot patch - Windows - Max 125 Char\",\r\n\t\t\"custom_notification_patch_message_mac\": \"Notification Text before normal patch - Mac - Max 70 Char\",\r\n\t\t\"custom_notification_reboot_message_mac\": \"Notification Text before reboot patch - Mac - Max 70 Char\",\r\n\t\t\"custom_notification_max_delays\": 3,\r\n\t\t\"custom_notification_deferment_periods\": [1, 4, 8],\r\n\t\t\"advanced_filter\": [\r\n {\r\n \"left\": \"patch-source\",\r\n \"right\": \"windowsupdate\",\r\n \"condition\": \"is\"\r\n },\r\n {\r\n \"left\": \"severity\",\r\n \"right\": \"medium\",\r\n \"condition\": \"greater-than-or-equal-to\"\r\n }\r\n ]\r\n\t},\r\n\t\"schedule_days\": 146,\r\n\t\"schedule_weeks_of_month\": 42,\r\n\t\"schedule_months\": 4162,\r\n\t\"schedule_time\": \"01:00\",\r\n\t\"notes\": \"Patch every Mon,Thu,Fri\\n1st,3rd,5th Week\\nJan,Jun,Dec\",\r\n\t\"server_groups\": [23500]\r\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
PowerShell
$apiKey = 'your_automox_api_key'
$headers = @{
"Authorization" = "Bearer $apiKey"
"Content-Type" = "application/json"
}
$url = "https://console.automox.com/api/policies/12345?o=0000"
$body = @"
{
"name": "Modified Name",
"policy_type_name": "patch",
"organization_id": 0000,
"configuration": {
"auto_patch": false,
"auto_reboot": true,
"notify_reboot_user": true,
"notify_user": true,
"missed_patch_window": true,
"patch_rule": "advanced",
"filters": ["*KB2267602*","*Exclude This Too*"],
"severity_filter": ["low","medium","high","critical","none","unknown"],
"include_optional": true,
"custom_notification_patch_message": "MODIFIED Notification Text before normal patch - Windows - Max 125 Char",
"custom_notification_reboot_message": "Notification Text before reboot patch - Windows - Max 125 Char",
"custom_notification_patch_message_mac": "Notification Text before normal patch - Mac - Max 70 Char",
"custom_notification_reboot_message_mac": "Notification Text before reboot patch - Mac - Max 70 Char",
"custom_notification_max_delays": 3,
"custom_notification_deferment_periods": [1, 4, 8],
"advanced_filter": [
{
"left": "patch-source",
"right": "windowsupdate",
"condition": "is"
},
{
"left": "severity",
"right": "medium",
"condition": "greater-than-or-equal-to"
}
]
},
"schedule_days": 146,
"schedule_weeks_of_month": 42,
"schedule_months": 4162,
"schedule_time": "01:00",
"notes": "Patch every Mon,Thu,Fri\n1st,3rd,5th Week\nJan,Jun,Dec",
"server_groups": [23500]
}
"@
Invoke-WebRequest -Method Put -Uri $url -Headers $headers -Body $body