Changing the NSX Manager user password through the API

Reading Time: 3 minutes

Changing the NSX Manager user password through the API is an article that shows how to change the user password using the API.

First and foremost, we will use the Postman application to interact with the NSX Manager API. You can download the application by accessing the below link:
https://www.postman.com/downloads/

But, of course, you can use your preferred API tool ๐Ÿ™‚

Accessing the NSX API Documentation

After accessing the NSX Manager GUI, you can access the API documentation, as we can see in the below picture:

This is a complete API guide and I highly recommend you check it before anything:

Listing the NSX Manager Users

So, to change the password of a specific user, we need to know what is the user id:

1- Open the Postman application and configure it as shown in the below picture.

Method: GET
URL: https://nsxm.lab.local/api/v1/node/users (in this case, our NSX Manager FQDN is nsxm.lab.local. Change it to your FQDN or IP address)

Under the Authorization tab, we need to specify the admin username. Without this authorization, the Postman will not be able to connect to the NSX Manager API:

This image has an empty alt attribute; its file name is image-154.png

As we can see in the above picture, the userid of the audit user is 10002.

Changing the audit User Password from the API

In this example, we are changing the audit user password:

Method: POST
URL: https://nsxm.lab.local/api/v1/node/users/10002?action=reset_password
Body: raw –> JSON

{
  "password": "Str0ng_Pwd!Wins$"
}

Change the value “Str0ng_Pwd!Wins$” by your new password:

The Status 200 OK shows that the API has been executed successfully by the Postman!
After that, you can try to open the NSX Manager GUI and access it using the audit user with the new password.

Changing the admin User Password from the API

Another way to change the user password will be shown below:

Method: POST
URL: https://nsxm.lab.local/api/v1/node/users?action=reset_own_password
Body: raw –> JSON

{
    "password": "YOUR_NEW_PASSWORD",
    "old_password": "YOUR_CURRENT_PASSWORD"
}

After that, you can try to access the NSX Manager GUI with the admin user + the new password ๐Ÿ™‚

Wrapping This Up

So, I am used to seeing the NSX Manager Alerts and detected a lot of alerts related to Password Management, as we can see in the below pictures:

So, these alerts were the trigger to know about the user password expiration ๐Ÿ™‚

3 responses to “Changing the NSX Manager user password through the API”