VCAP6-NV Deploy - Objective 8.1 - Administer and Execute calls using the VMware NSX vSphere API



VMware NSX-V VCAP6-NV VCIX6-NV

Published on 30 July 2017 by Christopher Lewis. Words: 811. Reading Time: 4 mins.

Objective 8.1 - Administer and Execute calls using the VMware NSX vSphere API

Objective Overview

  • Construct and execute an API call using correct syntax and formatting
  • Programmatically configure system parameters including:
    • NSX controller syslog
    • Modify DLR declared dead time
  • Analyze, modify, and successfully retrieve configuration data using an existing API call.

Objective Prerequisites

The following prerequisites are assumed for this Objective:

  • A working VMware vSphere 6.x environment.
  • A working VMware NSX 6.x implementation.

Objective Breakdown

Construct and execute an API call using correct syntax and formatting

For API calls I tend to use Postman. I’m not sure how you can get the incorrect syntax when using the API guide from VMware. Within Postman, you choose the Request Type (i.e. GET, POST, DELETE, etc) and then enter the full URL of the API call.

In this example we are going to use Postman query the NSX API for the ID of the NSX Controller’s.


  1. Launch Postman.
  1. Within the Builder, select GET from the dropdown.
  1. Enter the API request URL into the text field.

  1. Click Authorization and select Basic Auth from the Type dropdown.
  1. Enter the Username and Password of the NSX Manager and click Update Request.
  1. Click Send.
  1. (Optionally) Click Save.
  1. Enter a suitable name within the Request Name text box, select which collection to add this Request too and click Save to <Collection Name>.

  1. We added the following as a Test to be completed after the request:

Programmatically configure system parameters including: NSX controller syslog

In this example, we’ll use the Controller ID from the previous example to update the NSX Controller SYSLOG settings via the API.

  1. Open Postman.
Get the NSX Controller ID
  1. Expand the VMware NSX collection and select Get Controller ID.
  1. Click Send.

Check the existing SYSLOG configuration
  1. Click Add (+) to create a new Request.
  1. Select GET from the drop down and type https://{{nsx-mgr}}/api/2.0/vdn/controller/{{controller-id}}/syslog into the API request URL text box.
  1. Click Authorization and select Basic Auth from the Type dropdown.
  1. Type the Username and Password of the NSX Manager and click Update Request.
  1. Click Send.
  1. As you can see, the SYSLOG configuration hasn’t been completed yet.
  1. Click Save.
  1. Type a suitable name within the Request Name text box, select which collection to add this Request too and click Save to <Collection Name>.
Update the SYSLOG configuration
  1. Click Add (+) to create a new Request.
  1. Select POST from the Request type dropdown.
  1. Type https://{{nsx-mgr}}/api/2.0/vdn/controller/{{controller-id}}/syslog into the Enter Request URL textbox.

  1. Click Authorization and select Basic Auth from the Type dropdown.
  1. Confirm the correct Username and Password and click Update Request.
  1. Click Body.
  1. Select the raw option and then select appplication/xml from the dropdown.
  1. Type (or copy and paste) the following into the body:
<controllerSyslogServer>
<syslogServer>**172.16.10.26**</syslogServer>
<port>**514**</port>
<protocol>**TCP**</protocol>
<level>**INFO**</level>
</controllerSyslogServer>
  1. Click Send.

  1. Click Save.
  1. Type a suitable name within the Request Name text box, select which collection to add this Request too and click Save to <Collection Name>.
Confirm SYSLOG Configuration

We can confirm the SYSLOG configuration by running the GET Controller SYSLOG Configuration request we saved earlier. The resultant screenshot is:

With request detail of:

<?xml version=1.0 encoding="UTF-8"?>
  <controllerSyslogServer>
    <syslogServer>172.16.10.26</syslogServer>
    <port>514</port>
    <protocol>TCP</protocol>
    <level>INFO</level>
  </controllerSyslogServer>

And that is it!

Programmatically configure system parameters including: Modify DLR declared dead time

From the previous example, I believe I have demonstrated the skills needed to run a REST API call for a particular scenario. The process would be:

  1. Use GET to check what is set.
  2. If nothing is set, then configure as required and upload using POST.
  3. If a configuration exists, update the configuration (obtained via GET) and POST/PUT the changes required.

For this example, you could:

  • Use GET https://{{nsx-mgr}}/api/4.0/edges to provide a list of ALL Edges that exist.
  • Identify the ID of the edge and then use GET https://{{nsx-mgr}}/api/4.0/edges/{edgeId} to work with that specific edge.
  • Copy the body of the GET request and create a request using the XML with an amended declareDeadTime.
  • Use a PUT Request for https://{{nsx-mgr}}/api/4.0/edges/{edgeId} with the XML to update the Declare Dead Time.

Analyze, modify, and successfully retrieve configuration data using an existing API call

Whilst not explicitly called out, this topic is covered though out this post.

Further Study

For more information on additional objectives in the exam, see VCAP6 - Network Virtualisation (NSX-V) Deployment Study Guide .

Published on 30 July 2017 by Christopher Lewis. Words: 811. Reading Time: 4 mins.