Using PHP to query NSX-v via REST


Whilst working on a little side project of mine, I wanted to be able to submit a REST API call against a NSX Manager. At first I was just going to use shell_exec to execute one of my python scripts, but after a bit of investigation, I found that I could use the PHP Client URL Library (cURL) .

It took me a little bit of time to get it working just the way I wanted, but now that I have the basics, it should be simple to be able to do most things through a webpage.

Here is a sample webpage which adds syslog information to a NSX Controller.

Everything is pretty much hard coded, but being php you could do almost anything you want…. like submit a form with the details.

Now I have figured this one out, I will be working out how to do it with AJAX/jQuery and will post up a sample working config once I figure it out.

Happy Coding!

 

 

 

 

Leave a Reply