REST API workflows for mounting and unmounting datastores

To perform mount and unmount operations for datastore 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.

Workflow for mounting datastores

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 that you want to mount.

2 /4.1/datastores/{moref}/backups Get the list of backups for a datatstore gets the list of backups for the specified datastore.

Pass the moref from Step 1.

Note the backupId that you want to mount.

3 /4.1/datastores/backups/{backupId}/snapshotLocators Get the list of Snapshot Locations gets details about the location of the specified backup.

Pass the backupId from Step 2.

Note the datastore and the location from the snapshotLocationsList list.

4 /4.1/datastores/{moref}/availableEsxHosts Get the list of Available Esxi Hosts gets the list of ESXi hosts that are available for mount operations.

Pass the moref from Step 1.

Note the availableEsxHostsList information.

5 /4.1/datastores/backups/{backupId}/mount Mount datastores for a backup mounts the specified datastore backup.

Pass the backupId from Step 2.

In the datastore and location attributes, pass the information from snapshotLocationsList in Step 3.

In the esxHostName attribute, pass the information from availableEsxHostsList in Step 4.

Workflow for unmounting datastores

Step REST API Comments
1 /4.1/datastores/backups/{backupId}/mounted Get the list of mounted datastores.

Note the datastore moref(s) that you want to unmount.

2 /4.1/datastores/unmount UnMount datastores for a backup unmounts the specified datastore backup.

Pass the datastore moref(s) from Step 1 to perform the unmount operation.