Query to trigger on "Alias" name and then delete all its open states #554
-
I have some troubles understanding exactly how the advanced query works, and if my use-case is even possible, so if I depict my goal here, then hopefully someone could give some hints if this is possible. I have defined some aliases - e.g. Here-and-now I have implemented that it will clear ALL states for my (wireless) interface, where these hosts are present. It works and looks like this:
The disadvantage is of course that it clears ALL states, which could give some glitches for others, so ideally I want to only target/clear the specific hosts within the alias |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
It's not possible with a single call to
This will effectively delete any existing states with the IPs set in the alias. However, this would only work if the items in the alias are actual IPs, not hostnames. |
Beta Was this translation helpful? Give feedback.
It's not possible with a single call to
DELETE /api/v2/firewall/states
. pfSense does not keep track of the alias in the firewall state so there is not a field that can be queried for that there. However, you could add some extra logic to your code achieve a similar result:GET /api/v2/firewall/aliases
to fetch the alias you're looking foraddress
field of the aliases response data. This should be a list of IPs.DELETE /api/v2/firewall/states?source__startswith=<IP from the alias's address list>
and/orDELETE /api/v2/…