Creating NSX objects with REST API

As has been purported many times it is possible to create objects via a RESTful API. Lets first look at the logical network segments in my environment. Whilst I show the GUI creation here this post highlights the the GUI method.

Screenshot 2014-06-03 08.48.13

There are none. This is a fresh instance. Now I am going to open up my web browser, in this case it is Mozilla, and click on my RESTClient plugin.

The REST client requires some details first. Authentication so it can communicate against the NSX manager and the Content-Type. It needs to know that it is posting XML data.

Screenshot 2014-06-03 09.05.25
Screenshot 2014-06-03 08.51.04
Okay so now I want to use the API to POST the attached XML snipper to create a virtual wire. The URL to access the virtual wire is https:///api/2.0/vdn/scopes//virtualwires.

This requires me to put in based on my environment POST:https://nsxmgr-l-01a.corp.local/api/2.0/vdn/scopes/vdnscopes-1/virtualwires

Screenshot 2014-06-03 08.54.34

The XML required for the creation of my switch is as follows:

Click submit!

We can see confirmation of the creation of our logical switch with the following output.

Time to confirm this against the webGUI.

Screenshot 2014-06-03 09.08.33

There we are. It is simple to use POST or GET to retrieve and deploy environments. It is possible, depending on your ability to use an API at scale to manager and run your environment based on the API! Pretty cool stuff.

2 thoughts on “Creating NSX objects with REST API

  1. Pingback: Timothy

  2. Pingback: Bulk creation of NSX rules with Python | Network Inferno

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">