PowerShell has a built-in Invoke-WebRequest cmdlet that can be used to send HTTP and HTTPS requests to a web service. In this recipe, we will demonstrate how to leverage the NSX REST API through PowerShell using the Invoke-WebRequest cmdlet.
Using the REST API with PowerShell
Getting ready
You should have a workstation with Windows PowerShell or PowerShell Core installed.
How to do it...
This recipe is divided into two parts of REST API requests using PowerShell: retrieving a configuration or information using HTTP GET, and creating a logical switch using HTTP POST.
...