NSX-T API: Embedded Documentation and Postman Collection
NSX-T Manager provides a REST API to automate management activities. You can interact with the API using RESTful web service calls over HTTPS. But what about the API documentation?
There are multiple ways to get to the NSX-T API documentation, such as embedded API documentation in the Manager, the API Explorer or using a Postman Collection.
NSX-T API Documentation
The best choice, in my opinion, is to use the embedded API documentation which is accessible via the help link in the Manager UI.
Of course, you can also check the VMware Docs website to get the API documentation for NSX-T by downloading the VMware NSX-T API Guide.
Finally, you can use the API Explorer on code.vmware.com: for example, for NSX-T 2.0 or NSX-T 1.1.
NSX-T Postman Collection
In my Postman article, I wrote about Postman Collections and how useful they are. As a reminder, Postman Collections are used to group individual requests together: they help you to consolidate requests, parameters, descriptions, tests, scripts in folders.
For NSX-V, the NSX-V Postman Collection is available on Github, but what about NSX-T?
NSX-T API is described in an OpenAPI format; we can download the OpenAPI specification of NSX-T Manager API using a simple call.
GET https://{{nsxmanager}}/api/v1/spec/openapi/nsx_api.yaml
Using cURL, I send the API request and download the result.
The -k parameter turns off cURL’s verification of the certificate (I’m using a self-signed certificate in my lab), and -O redirects the output to a file instead of stdout.
NB: if you are now sure about the syntax, you can build the request in Postman and use the code snippets generator.
Once you have the file, you can just use Postman’s import function and BOOM: 772 1162 NSX-T API requests automatically populated and documented into Postman.
edit:
- The NSX-T 2.0 Postman collection contains 772 API requests
- The NSX-T 2.1 Postman collection contains 852 API requests
- The NSX-T 2.3 Postman collection contains 960 API requests
- The NSX-T 2.4 Postman collection contains 1162 API requests