vSphere Restful API - ji-it/CloudTides GitHub Wiki

Prerequisites

In order to try out the vSphere RESTful API, make sure the following are available:

  • Accessible vSphere from local machine
  • Access to vSphere account with elevated privileges for deploying and destroying VMs
  • Postman API Client. Download here

Setting up Postman Client

  1. Install Postman for local OS based by following instructions on official Postman Site
  2. Sign in with an account or skip the sign in to use the app.
  3. Create an environment by clicking the eye icon and then "Add". Set up as the environment as shown below.

Step 1: Creating an environment

  1. Set up the environment name and the variable: initial value pairs as shown in the image.
    • Environment Name - Use any name suitable for you. eg. vCenter

    Keys

    • vc: ipaddress of vcenter
    • user: vCenter SSO login username
    • password: vCenter SSO login password

Step 2: Creating an environment

  1. Add the environment and select it at the No environment option on Postman

Step 3: Creating an environment

  1. Download the collection attached here and import into Postman using the Import button and dragging the .json file.

Before Use

  1. Expand the resources for Deploy VM, or Destroy VM

  2. Make sure the login request is sent to the following endpoint https://{{vc}}/rest/com/vmware/cis/session using Basic Auth type of authorization. Fill in the username and password as shown in the image below.

  3. Click on Update Request button

  4. Perform the actions using RESTful API Test Cases

Additional vSphere API References

vSphere API Reference