Showing posts with label RESTAPI. Show all posts
Showing posts with label RESTAPI. Show all posts

Wednesday 10 April 2019

Invoke-NSXWebRequest in PowerCLI

From a few days, I was trying to use Invoke-NSXWebRequest to make a RESTApi Call in PowerCLI.

I was not sure how to do this at once, Learning something is always good. I know I am not that good at scripting, but at least I know how to get my work done.
Not every cmdlet is available in POWERNSX  as of now, but nowadays EVERYTHING IS API & API IS EVERYTHING.

So here I have enabled high availability for NSX Edge using POWERNSX & RESTAPI


from NSXRestAPI Documentation  following syntax


 where method type is PUT



Defined a Variable named $Body and passed onto the given content.





Thursday 29 March 2018

Re-Deploying an EdgeGateway using RESTAPI


I am upgrading my lab from vCloud Director from 8.20 to 9.0. One of the tasks is to upgrade existing vShield Edge or Edge Gateway from 5.5.4 to 6.3.4.Although it's optional, anyhow we have to upgrade as we were moving from Isolated Port Group network backing to VXLNA backed Port Groups. As I always strive to find different ways to perform the same task, I came across this POSTMAN from which this task could also be initiated.Hereby attached is the screenshot along with how one can navigate to the edge gateway of an ORG.

As mentioned in the previous post, Login to vCD using POSTMAN you may get started following that.




Searched for ORGANIZATION named VIRTUAL SINGH, double-click on href.


Navigated to myVDC named VSINGH VDC.



Here navigating to ProviderVDC named GoldPvdc 

Finding the networking href for VDC


Finding the appropriate Edge Gateway

And Using POST method to Redploy the edge gateway.

Edge gateway redeploying initiated using REST API from Postman Client in vCloud Director.

Thursday 16 November 2017

Login in vCloud Director using REST API Client - POSTMAN

  • Nowadays most of the virtualization products support REST-API.  
  • I first learned to interact using rest-api is with RavelloSystems(a cloud platform by Oracle)
  • The best client I have come across for it is POSTMAN client available for windows, mac & Linux. I have installed it on my MacBook & windows 10 machine. 
  • So this time I wanted to interact with vCloud Director 8.2 & 9.0 using REST-API
  • After a long day meeting and looking for how to log in successfully in vCD using postman client, somehow I figured it late night
  • So the basic options that we use in it are GET, PUT, POST & DELETE.
  • So if you have worked on HTML it makes it easy to understand the output.
  • As VMware has already started in vCenter 6.5 - REST API explorer.

Steps to login in vCD using POSTMAN

  • URL for vCD i.e
    https://IP or FQDN/api/sessions
  • Authentication- Basic (As per snapshot no. 1)
        Username- administrator@system   :- If you are a system administrator.
        I found it difficult for the username which took me this much time. So this user can be a LDAP integrated user or Active Directory.
        Password-  As per your directory
  • Once authorized with Status:200 OK .  In the AUTHORIZATION tab as highlighted, we have HEADERS tab where we will recieve a x-vcloud-authorization: token.
  • Instead of using your credentials for authentication, we can use the custom header (As per snapshot no. 2 & 3).
  • Now we are ready to work on this REST-API for interaction using postman client.