What is REST API?
if you are new to Rest API and wondering what exactly it is and what do we do using API, then I would recommend reading this article first before moving down further in this post. Also I found this article very useful to understand how Rest API works.
Before starting the topics of objective 8.1, I want to pen down few facts about Rest API.
- The NSX Manager accepts API requests on TCP port 443 over HTTP application protocol.
- You need a rest client to execute Rest API calls. There are plenty of clients available such as Postman and CURL (linux based). You can also integrate the Rest client in your browser. For mozilla firefox you can add this extension and for chrome you can add this
- Rest API’s are usually used when you can’t do something from GUI (because there is no option available) or when you want to automate stuffs using scripting or some other tools.
- The REST API utilises HTTP requests and allow you to programmatically create, retrieve, modify or delete NSX objects.
- You can use HTTP GET commands to read and retrieve objects, HTTP PUT or POST to create or update objects and HTTP DELETE to delete objects.
Construct and execute an API call using correct syntax and formatting
There are a couple of things which you need to construct an API request.
1: Basic Authentication: Credentials which the REST client will use to authenticate against NSX manager. This can be NSX admin user or any AD user.