To perform restore operations for VMDKs 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 moref from the VMware Managed Objects URL. Note the moref for the VM in which the VMDK is located. |
2 | /4.1/vm/{moref}/backups | Get VM Backups gets a list of backups for the specified VM. Pass the moref 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/{backupId}/vmdklocations | Get Vmdk Locations gets a list of VMDKs for the specified VM. Note the vmdkLocationsList information. |
5 | /4.1/vm/{moref}/backups/{backupId}/availabledatastores | Get Available Datastores get a list of datastores that are available for the restore operation. Pass the moref from Step 1. Pass the backupId from Step 2. Note the DatastoreNameList information. |
6 | /4.1/vm/{moref}/backups/availableesxhosts | Get available ESX Hosts gets the information for the host on which the backup is stored. Pass the moref from Step 1. Note the availableEsxHostsList information. |
7 | /4.1/vm/{moref}/backups/{backupId}/restorevmdks | Restore a VMDK from a backup restores the specified VMDK from the specified backup. In the esxHost attribute, pass the information from availableEsxHostsList in Step 6. Pass the information from Steps 3 through 5 to the vmdkRestoreLocations attribute:
|