NSM API Login
daniel_lilja
Enthusiast ✭✭
Hi,
does anyone know how to correctly login with the NSM API?
I have tried with my mysonicwall username and password and also with the tenant id. But All i get back is:
{'status': {'info': [{'code': 'NOK', 'level': 'error', 'message': 'Invalid Username/Password.'}], 'success': False}}
Category: Developer Hub
0
Answers
Hello @daniel_lilja,
I tested on my end and also getting the same results. I am checking internally and will keep you posted.
Thanks!
Shipra Sahu
Technical Support Advisor, Premier Services
Hi @daniel_lilja ,
To login to NSM one needs to come via the CSC (Login to CSC and click the Management tile). Direct login to NSM is not available as of now. The error you are experiencing is expected.
Now to access the APIs directly, the best you can do is to login to NSM in browser via CSC and do an F12 capture. Grab the 'Authorization' Header from an API request to NSM. It has the value something like "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzZ......"
Use the header for all your API requests. That is Set Header 'Authorization' with value '"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzZ......' prior to accessing the APIs.
Thanks
@abkumar i see, when will it be possible to access the API directly for integrations and automation?
@abkumar,
I actually did try that as well. Even after the successful authorization using the bearer token, I was getting the exact same error. I also tried using any API post that and got "unauthenticated for invalid credentials" as the message. Is there something more to be done after the authorization?
Thanks!
Shipra Sahu
Technical Support Advisor, Premier Services
@shiprasahu93 that worked for me via Python, did you directly via the Swagger? I didnt get it working via the Swagger, just via Python.
Yes, I was testing via Swagger directly.
Shipra Sahu
Technical Support Advisor, Premier Services
Hi @daniel_lilja / @shiprasahu93 ,
The swagger can be made to work if the same token is provided in the API request.
One can do so by 1. clicking the Lock Icon next to the API. 2. Copy Pasting 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzZ.....' and 3. Click Authorize
Thanks,
Abhishek
@abkumar when will it be possible to access the API directly for integrations and automation?
Hi @daniel_lilja ,
Support for direct access of API is in the plan. But sorry, I don't have an ETA as of now.
Thanks,
Abhishek
@abkumar and @shiprasahu93 any updates regarding direct access of API?
@daniel_lilja You can use postman AOI to login to NSM:
First API:
Second API call with OTP.
tested and working
hi everyone SonicWall hace ETA for direct accesss?