SonicOS API provides an alternative to the SonicOS Command Line Interface (CLI) for configuring selected functions. SonicOS API is disabled by default in SonicOS. Any attempt to access SonicOS API while it is disabled results in an HTTP 403 Forbidden error.
To use the SonicOS API, you must enable it, either through the SonicOS Management Interface or from the CLI.
SonicOS API is supported on all platforms running SonicOS 6.5.4 and higher.
NOTE: Commands for adding IPv6, MAC and FQDN address objects and their supported schema can be found in the SonicOS API 6.5.4 Reference Guide
You are free to choose Swagger, Postman, Git bash, or any application that allows API calls, if you are using a Linux-based operating system you can execute cURL from the terminal.
Please refer to https://sonicos-api.sonicwall.com for the entire list.
Only the first 2 steps of this article would change, depending on the SonicWall model you use. Commands are the same for both Gen6 and Gen7 SonicWall devices.
For this article, I'm using Postman App and will be showing the commands to run on cURL for each step.
This release includes significant user interface changes and many new features that are different from the SonicOS 6.5 and earlier firmware. The below resolution is for customers using SonicOS 7.X firmware.


NOTE: https://IP-address:port/-- Replace this with your SonicWall's Public or private IP address with the right management port number (If the management port is 443, you can directly use https:// followed by the IP address without the port number too).



curl --location --request POST 'https://192.168.168.168/api/sonicos/auth' \--header 'Accept: application/Json' \--header 'Content-Type: application/Json' \--header 'Authorization: Basic YWRtaW46cGFzc3dvcmQ=
--data-raw '{"override" : true}'
NOTE: I have the add.Json file saved on to my desktop and hence I was able to call it into the command, if you have created the Json the file in a different location then make sure you are executing the command from that location.
curl -k -i -X POST "https://192.168.188.200/api/sonicos/address-objects/ipv4" -H "accept: application/Json" -H "Content-Type: application/Json" -d @add.Json

curl -L -X POST 'https://192.168.168.168/api/sonicos/config/pending' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Basic YWRtaW46cGFzc3dvcmQ=' \
--data-raw ''
curl -L -X DELETE 'https://192.168.168.168:443/api/sonicos/auth' \-H 'Authorization: Basic YWRtaW46cGFzc3dvcmQ='
NOTE: All the address objects need to be of the same type Eg: IPv4, IPv6, MAC, FQDN etc. The commands vary based on the type of objects that you are adding.
CAUTION: If you miss performing the action in Step 5 and Execute the command in Step 6 you will lose all the configuration changes made in the current session.
This release includes significant user interface changes and many new features that are different from the SonicOS 6.2 and earlier firmware. The below resolution is for customers using SonicOS 6.5 firmware.
EXAMPLE: Let us go through the steps for adding three IPv4 host address objects on zone LAN with IP addresses 192.168.168.10, 192.168.168.20 and 192.168.168.30.
You would need to follow the below steps to add multiple address objects at once using SonicOS APIs.

TIP: You are free to choose Swagger, Postman, Git bash, or any application that allows API calls, if you are using a Linux based operating system you can execute cURL from the terminal. For this article I am using Git bash on Windows.


curl -k -i -u "admin:password" -X POST https://192.168.188.200:443/api/sonicos/auth

NOTE: I have the add.Json file saved on to my desktop and hence I was able to call it into the command, if you have created the Json the file in a different location then make sure you are executing the command from that location.
curl -k -i -X POST "https://192.168.188.200/api/sonicos/address-objects/ipv4" -H "accept: application/Json" -H "Content-Type: application/Json" -d @add.Json
NOTE: Commands for adding IPv6, MAC and FQDN address objects and their supported schema can be found in the SonicOS API 6.5.4 Reference Guide
curl -k -X POST "https://192.168.188.200/api/sonicos/config/pending" -H "accept: application/Json"

curl -k -i -u "admin:password" -X DELETE https://192.168.188.200/api/sonicos/auth
CAUTION: If you miss to perform the action in Step 5 and Execute the command in Step 6 you will lose all the configuration changes made in the current session.
You can manually log in to the firewall to check the changes made
Navigate to MANAGE | Objects | Address objects to check for the changes.