Skip to content

Query to trigger on "Alias" name and then delete all its open states #554

Discussion options

You must be logged in to vote

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:

  1. Make a request to GET /api/v2/firewall/aliases to fetch the alias you're looking for
  2. In your code, iterate over the items in the address field of the aliases response data. This should be a list of IPs.
  3. For each item in the array, and depending on the direction of the traffic you're looking for, make a request to DELETE /api/v2/firewall/states?source__startswith=<IP from the alias's address list> and/or DELETE /api/v2/…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@HovKlan-DH
Comment options

Answer selected by HovKlan-DH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants