How can i get license information from all tenants using MySonicWall API
Hello, i need the license information from all the tenants ("My Workspace -> Products") using the MySonicWall API.
I did all the procedures from the Getting Started: MySonicWall APIs and got my MSW API KEY.
I tried using the https://api.mysonicwall.com/api/mssp/applicable-mssp-product-services endpoint (From Postman), Following the first steps of this tutorial, and got the same error as the comment from that page said "401 Unauthorized" Using both, Bearer Token authorization and X-API-KEY header, with the MSW API KEY as the value:
(in the --my-api-key-- i'm using the respective API KEY i got from the Getting Started tutorial)
What is the endpoint to get all the tenants license info (expiration date, etc. ) and why am i get the 401 Unauthorized error?
Sorry if i missed some information from the documentation, and for any spell mistakes i made.
Thanks.
Best Answer
-
chandan SonicWall Employee
MySonicWall API supported authentication method is- X-API-KEY in request header.
Please refer to https://www.sonicwall.com/techdocs/pdf/msw-api_guide.pdf for more details.
0
Answers
did you try simple query with api authentication key and get the query response correctly ?
otherwise: https://api.mysonicwall.com/mssp.html according to this document, you should add another keys like below.
I tried doing Authentication by Bearer Token, Basic Auth and API Key, none had worked, then i saw in this page
a comment by FASTNET_TECH saying to use the X-API-KEY header with the api-key as the value and didin't work.
As for the tutorial i mentionded earlier, i am stuck in the first step, as i tried to
'GET /api/mssp/applicable-mssp-product-services using your MSW API key'
as the tutorial said, and got 401 Unauthorized, without any information.
See this, I'm able to get the result:
Sorry for missig the information about the x-api-key in the documentation. i did got the tenant info from this endpoint: /api/hgms/get-cloud-tenants and that why i did define that as the correct awnser. but about this comment, i still don't get the 200 OK from this endpoint: /api/mssp/applicable-mssp-product-services. Here is a screenshot:
I'm still doing somenting wrong?
Again, sorry for the trouble and bad english.
Thanks.
@MateusT - Please raise a CS request with your MSW ID to get this checked.
I had similar Postman Headers for both the below API and both are working fine:-
https://api.mysonicwall.com/api/hgms/get-cloud-tenants?isforced=false&bisfromCSC2=false
https://api.mysonicwall.com/api/mssp/applicable-mssp-product-services
Thanks & Regards,
Santosh.
I'm having exactly the same problem like OP, GET request to
https://api.mysonicwall.com/api/mssp/applicable-mssp-product-services
returns401 Unauthorized
response despite the valid API key, request tohttps://api.mysonicwall.com/api/hgms/get-cloud-tenants
works fineIs there any option to make it works?