NSM On-Prem - Authentication with API

Description

Logging into NSM On-Prem with API needs authentication first. This KB illustrates how to authenticate with API with Postman.

For NSM On-Prem instances  without 2FA, Step 1 is good enough. For NSM On-Prem instances with 2FA, follow Step 1-3.

 

Step 1. Get Bearer Token:

POST https://(NSM ON-Prem IP:port)/api/manager/auth
Body:

{
  "override": true,
  "password": "Real Password",
  "user": "admin"
}
Clicking on Send it will return Bearer Token at "message" section. Notice this NSM On-Prem instance has 2FA enabled.
 

Step 2. Copy the Bearer Token (between " ") from Step 1 and paste it to Collection, so the rest of APIs can inherit.
Note: 
Make sure the rest of API calls in this collection Authentication to use "Inherit auth from parent".

 

 

 

Step 3. create a new API call to send 2FA code. Note that this is for Email 2FA code. If using Authenticator, skip this step.
POST https://(NSM ON-Prem IP:port)/api/manager/tfa/resend

POST https://(NSM ON-Prem 

Step 4. create a new API call to verify 2FA code.

POST https://(NSM ON-Prem IP:port)/api/manager/tfa/verify
Body:
{"code":"369621","2faType":"email"}
Note: 
This code is the 2FA code emailed from Step 3. If Microsoft/Google Authenticator is used, the API call would be:
{"code":"369621","2faType":"app"}

Note the Bearer Token itself is the same. one. It just has been verified with 2FA. 

Now the Bearer Token has been verified. We can test it by retrieving all tenants info:

GET https://(NSM ON-Prem IP:port)/api/manager/tenants

 

 

Related Articles

  • NSM Reports - Understand Productivity Report
    Read More
  • NSM 4.0 - Configuration Auditor
    Read More
  • NSM – Template Dos and Don'ts
    Read More
not finding your answers?