Using the REST API with cURL
The NSX REST API can also be consumed via command-line tools, such as cURL (c for Client). cURL is a free and open source software that can be downloaded from https://curl.haxx.se/. Most Linux- or Unix-based operating systems come pre-installed with cuRL, such as the vCenter Server Appliance, however Microsoft Windows typically requires it to be manually installed.
Getting ready
You should be logged in to a guest operating system with cURL installed. In this example, we will use cURL from the Git command prompt in a Windows workstation.
How to do it...
This recipe is divided into two parts of REST API requests using cURL: retrieving a configuration or information, and creating a logical switch.
Requesting the HTTP GET REST API via cURL
In this example, we will perform an HTTP GET REST API request via cURL script:
- To check whether cURL is available in the operating system, use the
curl ---version
command.
- Run the following cURL script:
curl -k -X GET -H "Accept: application...