Skip to main content
SnapCenter Plug-in for VMware vSphere
A newer release of this product is available.

REST API workflow to restore deleted VMs

Contributors netapp-yvonneo netapp-revathid

To perform restore operations for VM backups using the SnapCenter Plug-in for VMware vSphere REST APIs, 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 datastore moref from the VMware Managed Objects URL.
Note the moref for the datastore on which the deleted VM resided.

2

/4.1/datastores/{moref}/backups

Get Datastore Backups retrieves a list of backups for the specified datastore.
Pass the moref from Step 1.
Note the backupId of the backup you want to restore.

3

/4.1/backups/{backupId}

Get Backup Details retrieves the details of the specified backup.
Pass the backupId from Step 2.
In the entities list, find the entityName that matches the deleted VM and note the UUID.

4

/4.1/vm/backups/{backupId}/snapshotlocations

Get snapshot locations retrieves the location of the snapshot for the specified backup.
Pass the backupId from Step 2.
Note the snapshotLocationsList information.

5

/4.1/datastores/{moref}/availableEsxHosts

Get available ESX Hosts retrieves the information for the host on which the backup is stored.
Pass the moref from Step 1.
Note the availableEsxHostsList information.

6

/4.1/vm/{uuid}/backups/{backupId}/restoreVm

Restore a VM from a backup restores the specified backup.
Pass the UUID from Step 3.
Pass the backupId from Step 2.
In the restoreLocations attribute, pass the information from snapshotLocationsList in Step 4; in the esxHost attribute, pass the information from availableEsxHostsList in Step 5.

If the VM backup is a partial backup, set the restartVM parameter to false.

Note: You cannot restore a VM that is a template.