Export Tech Support Report (TSR) using SonicOS API
01/31/2024
0 People found this article helpful
76,160 Views
Description
This article covers how to download Tech Support Report or TSR from the SonicWall device.
The output needs to be saved manually. 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. Commands are the same for both Gen6 and Gen7 SonicWall devices.
For this article, I'm using the Postman App and will be showing the commands to run on cURL for each step.
List of applicable APIs:
Navigate to MANAGE | API and click on the link https://SonicOS-api.sonicwall.com. Swagger will prepopulate your SonicWalls’s IP, MGMT Port, and Firmware so it can give you a list of applicable APIs.
![Image](https://sonicwall.rightanswers.com/portal/app/portlets/results/onsitehypermedia/090220721560665.png?linkToken=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJzb25pY3dhbGwiLCJleHAiOjE3NTM0OTkwNTYsImlhdCI6MTcyMTk2MzA1Nn0.qtrXEC6t9LRAz5w11r6Ji74xvDZGxKnT7MNXZs9s870)
Resolution
Step 1: Enable and log in using SonicOS API
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. Please enable the SonicOS API module in the SonicWall UI.
Gen 7: Enable SonicOS API Gen7
Gen 6: Enable SonicOS API Gen6
The above KB also has the steps on how to log in using API Applications
CAUTION: My SonicWall IP address is 192.168.168.168 with user credentials as admin/password. This has to be kept in mind while running the commands from the below screenshots.
Step 2: Using GET to export TSR
![Image](https://sonicwall.rightanswers.com/portal/app/portlets/results/onsitehypermedia/090240131110513.png?linkToken=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJzb25pY3dhbGwiLCJleHAiOjE3NTM0OTkwNTYsImlhdCI6MTcyMTk2MzA1Nn0.qtrXEC6t9LRAz5w11r6Ji74xvDZGxKnT7MNXZs9s870)
The output is the Tech Support Report. This can be saved using Copy command (marked as 1 in the above picture) and pasting in notepad. You can also use various Gits to save the file, although that is beyond the scope of this article.
cURL command for the above call is:
curl --location --request GET 'https://192.168.168.168/api/sonicos/export/tech-support-report' \
--header 'Content-Type: application/Json' \
--header 'Authorization: Basic YWRtaW46c29uaWN3YWxs' \
--data '{"override" : true}'
Step 3: Log out the SonicWall with API
It is recommended to log out from the SonicWall via API once the desired configuration is committed.
![Log out](https://sonicwall.rightanswers.com/portal/app/portlets/results/onsitehypermedia/090221208116391.png?linkToken=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJzb25pY3dhbGwiLCJleHAiOjE3NTM0OTkwNTYsImlhdCI6MTcyMTk2MzA1Nn0.qtrXEC6t9LRAz5w11r6Ji74xvDZGxKnT7MNXZs9s870)
curl -k -i -u "admin:password" -X DELETE https://192.168.188.200/api/sonicos/auth
![Image](https://sonicwall.rightanswers.com/portal/app/portlets/results/onsitehypermedia/090200524557097.png?linkToken=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJzb25pY3dhbGwiLCJleHAiOjE3NTM0OTkwNTYsImlhdCI6MTcyMTk2MzA1Nn0.qtrXEC6t9LRAz5w11r6Ji74xvDZGxKnT7MNXZs9s870)
Related Articles
Categories