REST API provides a interface to interact with NSX for all kind of operations. NSX is architectured from ground up with a RESTful API. This provides to possibility to configure NSX and related services.
Cloud Management Platforms like vRA or OpenStack are utilizing the NSX REST API for automation or orchestration tasks. Some tasks on NSX can only be done via CLI or API.
As a quick reminder, REST Clients distinguish between the interaction: 
  • GET - Receive information about a resource
  • HEAD - Retrieve the metadata associated with the resource
  • PUT - Update a resource
  • DELETE - Remove resource
  • POST - Create new resource

In this post I'm using the Firefox REST client add-on but an REST client will work. Before we can start we need to setup our authentication and request header.
We configure basic authentication by specifying the username admin and the corresponding password. 

Next we need to setup the header. Name is Content-Type and value is application/xml. This defines that your payload is in xml format.

So let get started... First we query the Controller information using the GET interaction.
https://nsxmgr-01a.corp.local/api/2.0/vdn/controller

And we can see the detailed output in the Response Body tab



Let now use a practical example and set the Syslog server on Controller 1.


And we can use the GET interaction to validate our operation.



In the next step lets create a logical switch. In the first step we need the query name of the Transport Zone or "vdnscope".

https://nsxmgr-01a.corp.local/api/2.0/vdn/scopes

In my case "vdnscope-1". For the Logical Switches we use the URL

https://nsxmgr-01a.corp.local/api/2.0/vdn/scopes/vdnscope-1/virtualwires







We can also validate this change from the GUI now


I think you now saw how powerful the NSX API can be. Imagine you need to create thousands of logical switches are firewall rules manually. 

The API Guide below provides extensive details on all operations: