Loop to get L3 firewall rules

AhmedJawad
Getting noticed

Loop to get L3 firewall rules

 

HI All, 

 

  Trying to loop over every firewall rule in my org and I'm getting the error blelow. 

 

 

response = dashboard.organizations.getOrganizationNetworks(org_id)

 
for network in response:
   
    fw_rules =  dashboard.appliance.getNetworkApplianceFirewallL3FirewallRules(network['id'])
 
File "C:\Users\p00091670\AppData\Local\Programs\Python\Python310\lib\site-packages\meraki\rest_session.py", line 277, in request
raise APIError(metadata, response)
meraki.exceptions.APIError: appliance, getNetworkApplianceFirewallL3FirewallRules - 404 Not Found, please wait a minute if the key or org was just newly created.
 
 
My debug file showing below 
 
2022-07-16 19:22:43       meraki:    DEBUG > {'tags': ['appliance', 'configure', 'firewall', 'l3FirewallRules'], 'operation': 'getNetworkApplianceFirewallL3FirewallRules', 'method': 'GET', 'url': '/networks/XXXXXXXXXXX/appliance/firewall/l3FirewallRules', 'params': None}
2022-07-16 19:22:43       meraki:    ERROR > appliance, getNetworkApplianceFirewallL3FirewallRules - 404 Not Found, b''
 
 Any idea, please? 
 
3 Replies 3
RaphaelL
Kind of a big deal
Kind of a big deal

Have you tried to see if the network that you are pulling the rules actualy contains a MX ?

 

You will get a 404 if the network doesn't containt a MX.

AhmedJawad
Getting noticed

Thank you for your reply, yes that was the issue is that I was looping over all including switches and wireless. after adding a condition to check on MX it worked. 

RaphaelL
Kind of a big deal
Kind of a big deal

Excellent ! Glad I was able to shed some light on your issues 🙂 

Get notified when there are additional replies to this discussion.