SonicOS API with python3
Best Answer
-
Jaime SonicWall Employee
Hi @Tytec,
Here's an example script to help get you started.
https://github.com/jaimeesc/sonicos_api_mass_edit_s2s_vpn_example
This example script can mass-edit site to site and tunnel interface VPN policies to automate a change to multiple policies. You'll see how to authenticate, pull down current configuration, edit, and push changes back & commit via SonicOS API.
Hope this helps.
0
Answers
The python request module should be fine. You can use postman to learn the API and then convert the code into python until you get familiar with it.
https://www.sonicwall.com/support/knowledge-base/how-to-migrate-fqdn-address-objects-from-a-gen-6-to-gen-7-device-using-sonicos-api/200812073105770/
Thanks MASTERROSHI, I will definitely try that. I have been using #curl from the terminal trying to get familiar with the syntax.
@Jaime
May I know what is the firewall url used for OS7?
I can get resp 200 with OK OS6.5 but only resp 400&404 for OS7.
@Nat,
The URI path is the same for SonicOS 7.0 (/api/sonicos/auth). Try enabling HTTP Basic Access Authentication in the SonicOS API settings on DEVICE | Settings > Administration.
Thanks Jamie!