In this example, we will create a logical switch using the HTTP POST REST API request via PowerShell:
- For HTTP POST, change the -Method to Post and include an XML payload using the -Body option, as follows:
# NSX Variables $NSXUsername = "admin" $NSXPassword = "VMware1!" $NSXManager = "https://nsxmgr-01a.corp.local" $NSXURI = "/api/2.0/vdn/scopes/vdnscope-1/virtualwires" # NSX Authorization Header $NSXAuth = [System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($NSXUsername + ":" + $NSXPassword)) $NSXAuthHeader = @{"Authorization"="Basic $NSXAuth"} # NSX XML Payload [xml]$XMLBody = "<virtualWireCreateSpec> <name>PowerShell-Logical-Switch</name> <description>Logical Switch ...