Disaster Recovery

Retrieving protected VMs with VMware Cloud DR REST API

VMware Cloud Disaster Recovery (VCDR) provides a REST API for monitoring and retrieving information about the service’s major components. This includes the cloud file systems, protected sites, protected VMs, protection groups, protection group snapshots, and recovery SDDCs. 

This blog post shows how to create a Postman collection that uses VMware Cloud DR REST API to retrieve VMs protected by the service – an idea initially developed by Pavlin Shterev. While the API is well documented, the requests authentication might be a little tricky.

There is also a great article that shows how to use the REST API with PowerCLI. It is written by Michael McLaughlin and Max Daneri and introduces a set of PowerShell cmdlets to monitor VMware Cloud Disaster Recovery (VCDR).

How to define a Postman collection for retrieving protected VMs

First you must create a Postman environment and setup the following variables (you can find more information about Postman variables here):

  • api_token – CSP API token required for authentication. Getting API Token to authenticate is described in the article mentioned above (see Getting a token section).
  • cloud_console_url – VMware Cloud Service console URL, e.g. : https://console.cloud.vmware.com
  • vcdr_fqdn – The FQDN of the VCDR Orchestrator.

Then create a VCDRGetProtectedVMs.postman_collection.json file with the following content:

Using the VCDR Postman collection

Now, you can import the provided JSON file in Postman and run the collection by selecting the Save Responses checkbox in the Advanced settings section. Then you can go to the Test results and see the response body and headers for each request by clicking on its name.

The collection is ready to be reused. You can easily modify it and add another request to retrieve the protection groups – just use the https://{{vcdr_fqdn}}/api/vcdr/v1alpha/cloud-file-systems/{{cfs_id}}/protection-groups URL and run it again.

This demonstrates how easy it is to consume the VCDR REST API via Postman.

Follow the VMware DR Community Team on Twitter @VMware_DR_team and send us any feedback.