Connecting to REST API servers
REST APIs provide a way to connect to servers by making requests in the Hypertext Transfer Protocol (HTTP) or the Hypertext Transfer Protocol Secure (HTTPS). The requests you send to the servers are in the form of a Uniform Resource Identifier (URI). The responses to the requests may be in Extensible Markup Language (XML), HyperText Markup Language (HTML), or JavaScript Object Notation (JSON). REST APIs use a stateless protocol. This means that the servers don't know what your previous request was. You have to send all the necessary information, such as credentials, in every request you make.
Tip
To connect your PowerCLI session to an NSX Manager, access to port 443
/TCP is required for REST API requests.
The Invoke-RestMethod
cmdlet sends an HTTP or HTTPS request to a RESTful web service. The syntax of the Invoke-RestMethod
cmdlet is as follows:
Invoke-RestMethod [-Uri] <Uri> [-Body <Object>] [-Certificate
<X509Certificate>] [-CertificateThumbprint...