Capture Client – Getting CC API token via MSW API key
08/19/2024 0 People found this article helpful 45,245 Views
Description
This document outlines how to generate Capture Client API token via MySonicWall API key to run CC API queries and Integrations
Requirements
Capture Client Advanced or Premier License
MSW API Key Feature Enabled
High Level Process
- Get a MSW API Key from MySonicWall
- Connect to MSW APIs
a. Get Tenant Information
b. Get Capture Client Access Code - Connect to Capture Client APIs
a. Get CC API Token
b. Use Token for CC APIs
Resolution
Get MSW API Key from MySonicWall
MSW APIs are enabled by default. If you don’t see this option in your account, call support.
- Login to MySonicWall Account.
- Navigate to My Workspace | User Groups | User List
- Click on ‘Generate API Key’ on the top right and a pop-up window will come up as below:
- Click on ‘View / copy’ icon to copy the Key and save it for future use. Here is the detailed MSW API reference guide to Generating MSW API Key.
Connect to MSW APIs using Postman
- Get CC Tenant Information
a. Open postman and add a new collection enter URL (https://api.mysonicwall.com/api/hgms/get-cloud-tenants) in the input field using ‘GET’ method
b. Click on ‘Headers’ tab and add below keys and then click ‘Send’.
Content-Type: application/json
X-api-key: Enter the MSW API key received in step above “Get MSW API Key from MySonicWall”.
c. Below response show up under ‘Body’ section. Click on copy icon to copy the response as that will be used next to generate the CC token.
d. Click on copy icon to copy the response and save the output to text file.
e. Now search for the Tenant name in the output (Text file) and find the associated "productGroupID" and keep it aside to be used in next step. - Get an access code for your CC tenant using the MSW API Token and the tenantId (ProductGroupID).
a. Add another collection, and enter URL (https://api.mysonicwall.com/api/generate-cscaccesscode ) in the input field using ‘POST’ method on Postman.
b. Enter the x-api-key in headers as above steps
c. Click on ‘Body’ section and select ‘raw’ and type / enter below text.
{"tenantId" : "InsertprodcutGroupID","tileName":"ISNSMSAFEENABLED"}
d. Now click on ‘Send’ and it will return ‘accessCode’ under Body.
e. Copy the ‘accessCode’ as that need to use in next step to Generate CC API Token.
NOTE : The generated access code is valid only for 5 minutes.
f. Alternatively, here is the sample Curl-based example: curl https://api.mysonicwall.com/api/generate-cscaccesscode -X POST -d "
{\"tenantId\":\"YOURTENANTID\",\"tileName\":\"ISNSMSAFEENABLED\"}" -H "Content-Type: application/json" -H "X-API-KEY: YOURAPIKEY
"
Replace the tenantid with ProductGroupID you received in step 1 and replace YOURAPIKEY with APIKEY generated.
Connect to Capture Client using Postman
Get Capture Client (CC) API Token:
- Add another collection enter URL (https://captureclient-36.sonicwall.com/api/auth/getApiToken) in the input field using ‘POST’ method.
a. Enter the x-api-key in headers as above steps - Click below on ‘Body’ section and select ‘raw’ and type / enter below text as per syntax. Code: From above step 2.d.
Syntax:{ "code":"InsertaccessCode"} - Alternatively, her is the Sample API call: POST https://captureclient-36.sonicwall.com/api/auth/getApiToken?cscaccesscode=NF80MDYzMTE4Ml5DNTYzQzk2QTFFQkE0RjA1ODk2MjU4RjJDQzA5Njk1OQ=
- Click ‘Send’ and will below response will show up under ‘Body’.
- You will get your MSW account email and CC API token in response body. CC API token info will be shown in ‘token’. Same token needs to be used for authentication when running CC API queries.
NOTE : The Capture Client API Token you generated is valid for 7 days.
Using Token for Capture Client APIs.
Below example is to get Endpoint list for Capture Client Tenant. Use the Capture Client API Token for Capture Client API calls for that specific tenant.
- Add a new collection and enter API URL (https://captureclient-36.sonicwall.com/api/endpoints/list) in the input field using the ‘GET’ method.
- Go to ‘Headers’ tab and select/enter ‘Authorization’ and then insert the CC API Token value (from step 4 above) in ‘token’ field.
- For more information about CC API queries, refer to Capture Client API docs - captureclient-36.sonicwall.com/api/docs/.
NOTE : Your Capture Client region is the domain for the SonicWall Capture Client portal you log into. For Europe region, Capture Client URL should be changed to https://captureclient-36eu.sonicwall.com
Related Articles
Categories
Was This Article Helpful?
YESNO