Skip to content

update_traffic_rule

Patch fields on an existing traffic rule (read-modify-write).

Side effects:

  • Modifies the named rule in place. The v2 PUT replaces the whole object, so this reads the current rule first and merges updates onto it before writing — only the keys you supply change.
  • Takes effect immediately on matching traffic.
  • Mutates controller state. Use dry_run=True to preview the change without applying.
update_traffic_rule(rule_id="65f...", updates={"action": "ALLOW"})
ParameterTypeRequiredDefaultDescription
rule_idstringyesThe _id from list_traffic_rules.
updatesobjectyesPartial traffic-rule record to merge. Common keys: action, matching_target, target_devices, enabled, plus target-specific fields.
controllerstringno”default”Name of the UniFi controller to target. Defaults to "default".
dry_runbooleannofalsePreview the change without applying it. Returns the predicted change set.