REST API workflow for restoring deleted VMs

To perform restore operations for VM backups using REST APIs for VMware vSphere, you must follow the prescribed sequence of REST API calls.

For each REST API, add https://<server>:<port> at the front of the REST API to form a complete endpoint.

Step REST API Comments
1 Go to http://<vCenter-IP>/mob Find the VM uuid from the VMware Managed Objects URL.

Note the uuid for the VM that you want to restore.

2 /4.1/vm/{moref}/backups Get VM Backups gets a list of backups for the specified VM.

Pass the uuid from Step 1.

Note the backupId of the backup you want to restore.

3 /4.1/vm/backups/{backupId}/snapshotlocations Get snapshot locations gets the location of the Snapshot copy for the specified backup.

Pass the backupId from Step 2.

Note the snapshotLocationsList information.

4 /4.1/vm/{moref}/backups/availableesxhosts Get available ESX Hosts gets the information for the host on which the backup is stored.

Note the availableEsxHostsList information.

5 /4.1/vm/{uuid}/backups/{backupId}/restoreVm Restore VM from a backup using uuid or restore a deleted VM restores the specified backup.

Pass the uuid from Step 1. Pass the backupId from Step 2. Pass the information from Steps 3 and 4 in the restoreLocations attribute.

  • If the VM backup is a partial backup, set the restartVM parameter to "false".
  • You cannot restore a VM that is a template.