...

VMware NSX-T API: How To Use Postman – Beginner’s Empowerment Guide

vmware-nsx-t-api-how-to-use-postman-beginners-empowerment-guide

NSX-T is like the James Bond of virtual network products by VMware, which can be completely driven by API’s.

But if you’re new to API tools like Postman, you might be scratching your head wondering, “How does this whole get, post and put thing even work?” Fear not, my tech-savvy friends!

Before we even attempt to get, post, and put, we need to establish an authenticated connection to the NSX-T managers. Once we’ve passed that virtual bouncer, we can proceed further.

So, grab your virtual helmet and let this article guide you, screenshot by screenshot, on how to easily set up Postman to connect to VMware NSX-T. We’ll even use a simple get call to obtain a list of certificates within the NSX-T managers. Exciting, isn’t it? Let’s get started!

Installing Postman for VMware NSX-T API Connection

Download Postman from https://www.postman.com/downloads/

Run through the installation steps which are pretty straight forward

Download Postman

When you first open Postman it will look pretty empty, similar to the screen shot below. We will soon start to create environments and collections

Postman API

Postman Setup for VMware NSX-T

Click on the button next to “No Environment” and select “Add” within the Environment block.

Postman Environment

Give your environment a name, I’ve made my environment name “NSX-T”.

I will then proceed to create 2 variables, by clicking on Add new variable. One is the host variable where I have entered the DNS name of my NSX-T manager. The second variable will be the admin password. Notice next to the variable name “admin_password”, the type equals secret. This ensures the password is hidden.

Postman NSX-T variables

Now we will create a new collection. Select collections on the left hand side and click on the new button, followed by Collection. Give your collection a name. I’ve used NSX-T for the collection name.

Postman NSX-T collections

Once the collection has been created, click on the Authorization tab. Select “Basic Auth” for type, enter in admin for the NSX-T user, and for password we will be using the variable that we setup previously. To do this we enter in {{admin_password}} in the password field. Remember admin_password is the variable name we setup previously.

Postman NSX-T authorization

Postman API Request for VMware NSX-T

Lets create our first API get request. Click on the NSX-T collection name and select “Add Request”

Postman NSX-T Add request

With this request we are going to be querying the certificates installed within our NSX-T managers

Make sure the request type is GET and the URL will be:

https://{{host}}/api/v1/trust-management/certificates

Notice how we use the {{host}} variable that we created earlier as opposed to typing out the full DNS name ?

Postman NSX-T GET request

Click on the Authorization tab and select “Inherit auth from parent”. Since we have set the authorization credentials on the NSX-T collections already, we don’t need to set them again here, we simply inherit the credentials from the parent.

Postman Inherit auth from parent

Press the Send button and you should receive a response in JSON format as well as a Status 200 OK response code. The response contains a list of all the certificates within the VMware NSX-T managers

Postman NSX-T JSON response

The last step we are going to perform is to save our query so we can use it later. Give the query a name, I’ve named mine “Get Certificates” and then click on Save.

Postman Get request

The post VMware NSX-T API: How To Use Postman – Beginner’s Empowerment Guide appeared first on SYSADMINTUTORIALS IT TECHNOLOGY BLOG.

Discover more from WIREDGORILLA

Subscribe now to keep reading and get access to the full archive.

Continue reading