I’m currently trying to update a Firewall rule in my Cloudflare account through the API, but I’m having some trouble. The rule currently blocks traffic from IPs in the range 10.128.3.0 and 58.65.25.21, but I need to add 10.20.78.5 to the list.
I’ve tried using the following API call to update the rule, but it doesn’t seem to be working:
It seems like the API call you provided is updating the entire rule instead of just adding an IP address to the existing rule. Instead, you should retrieve the existing rule using a GET request and then modify the filter to add the new IP address before updating the rule using a PUT request.
Here’s an example API call that should add the new IP address to the existing rule:
Within the rule, there’s a filter. It’s the filter you need to update. Get the filter ID from the response to your call to the rule, then make the appropriate request to the update filter endpoint.