Python api script mxfirewallcontrol.py json format error

JFarley
New here

Python api script mxfirewallcontrol.py json format error

Hey all, absolutely new to API's. I'm trying to use the python script mxfirewallcontrol.py to insert a rule into a network's l3 firewall.

 

Following the example at create.meraki.io/build/mx-firewall-control-python-script/ for expressing rulesets I've replicated the following:

 

python mxfirewallcontrol.py -k xxx -o "xxx" -f "type:network,name:xxx" -c insert:2:"{ ""protocol"":""any"", ""srcPort"":""Any"", ""srcCidr"":""Any"", ""destPort"":""Any"", ""destCidr"":""192.168.26.0/24"", ""policy"":""deny"", ""syslogEnabled"":false, ""comment"":""D - All to POS VLAN"" }" -m simulation

 

and I receive:

 

@ INFO: Retrieving organization info
@ INFO: Selecting networks and templates according to filters
@ INFO: Simulation mode. Changes will not be saved to cloud
@ ERROR 50: Ruleset to be added must be given in JSON format

 

I tried replicating the example exactly and editing in my info and it still fails.

 

Any advice would be appreciated.

1 Reply 1
Adam
Kind of a big deal

My first observation is the -m simulation.  I don't think you are running a real query.  Nextly you may want to look here

https://community.meraki.com/t5/Solutions-APIs/Put-API-L3-firewall-rules/m-p/22817

 

In that thread, they were doing a similar function and it discusses the proper syntax and a few nuances. 

Adam R MS | CISSP, CISM, VCP, MCITP, CCNP, ITILv3, CMNO
If this was helpful click the Kudo button below
If my reply solved your issue, please mark it as a solution.
Get notified when there are additional replies to this discussion.