For those following alone
The documentation for the API is absolute garbage:
This isnt accurate:
"To generate NSM token using MSW API key:
1. Get your tenantId and tenantserial using the MSW API Key.
You can find tenantId and tenantserial on the MySonicWall Swagger page under General category with
API call, https://api.mysonicwall.com/api/hgms/get-cloud-tenants."
it is is something like this:
import requests
url = "https://api.mysonicwall.com/api/hgms/get-cloud-tenants"
params = { "username": "MYUSERNAME", "isforced": "false", "bisfromCSC2": "false"}
headers = { "accept": "text/plain", "X-API-KEY": "MY API KEY"}
response = requests.get(url, headers=headers, params=params)
print(response.status_code)print(response.text) # Since the accept header is 'text/plain', print the text content of the response
Now what state are isforce and bisfromCSC2 need to be in who knows do those need to wexists also who knoow
I do know that my 401 error is now a 200 but getting
{"operationStatus":"NOK","msgCode":"MSWAPP:UNAUTHUSER","msgId":"101","msgDesc":"You are not authorized."}
Answers
For those following alone
The documentation for the API is absolute garbage:
This isnt accurate:
"To generate NSM token using MSW API key:
1. Get your tenantId and tenantserial using the MSW API Key.
You can find tenantId and tenantserial on the MySonicWall Swagger page under General category with
API call, https://api.mysonicwall.com/api/hgms/get-cloud-tenants."
it is is something like this:
import requests
url = "https://api.mysonicwall.com/api/hgms/get-cloud-tenants"
params = { "username": "MYUSERNAME", "isforced": "false", "bisfromCSC2": "false"}
headers = { "accept": "text/plain", "X-API-KEY": "MY API KEY"}
response = requests.get(url, headers=headers, params=params)
print(response.status_code)print(response.text) # Since the accept header is 'text/plain', print the text content of the response
Now what state are isforce and bisfromCSC2 need to be in who knows do those need to wexists also who knoow
I do know that my 401 error is now a 200 but getting
{"operationStatus":"NOK","msgCode":"MSWAPP:UNAUTHUSER","msgId":"101","msgDesc":"You are not authorized."}