Performing 1-Click Restore
Using Veeam Backup Enterprise Manager RESTful API, you can restore a VM guest OS file or folder from the backup to its initial location on the VM guest OS.
Prerequisites
- Make sure you are logged on to Veeam Backup Enterprise Manager under the user account to which the Portal Administrator, Portal User or Restore Operator role is assigned.
- If you are logged on using the account to which the Portal User or Restore Operator role is assigned, make sure that your restore scope permits you to restore guest OS files from the necessary VM.
Procedure
- After you access Veeam Backup Enterprise Manager RESTful API and create a new logon session, examine the representation of the logon session that the server has returned:
Request: POST http://localhost:9399/api/sessionMngr/
Request Header: Authorization: Basic QWRtaW5pc3RyYXRvcjpUcmVzc3Bhc3Mx
Response: 201 Created
Response Header: X-RestSvcSessionId: NDRjZmJkYmUtNWE5NS00MTU2LTg4NjctOTFmMDY5YjdjMmNj
Response Body: <LogonSessions xmlns="http://www.veeam.com/ent/v1.0"> |
- Find the link for the /catalog/vms resource collection:
<Link Rel="Down" Type="CatalogVmReferenceList" Href="http://localhost:9399/api/catalog/vms" /> |
- From the link, retrieve the URL for the /catalog/vms collection. The URL is specified in the Href element. Send the GET HTTP request to the retrieved URL. The server will return a representation of all VMs whose guest OS files have been indexed during backup.
Request: GET http://localhost:9399/api/catalog/vms
Request Header: X-RestSvcSessionId: NDRjZmJkYmUtNWE5NS00MTU2LTg4NjctOTFmMDY5YjdjMmNj
Response: 200 Success
Response Body: <EntityReferences xmlns="http://www.veeam.com/ent/v1.0"> |
- Examine the received resource representation and find a link to the entity of the necessary VM. The Rel attribute in the link will be set to Alternate:
<Link Rel="Alternate" Href="http://localhost:9399/api/catalog/vms/fileserver01?format=Entity" /> |
- Retrieve the URL for the VM resource and send the GET HTTP request to the retrieved URL. The server will return a resource representation of the VM:
Request: GET http://localhost:9399/api/catalog/vms/fileserver01?format=Entity
Request Header: X-RestSvcSessionId: NDRjZmJkYmUtNWE5NS00MTU2LTg4NjctOTFmMDY5YjdjMmNj
Response: 200 Success
Response Body: <CatalogVm xmlns="http://www.veeam.com/ent/v1.0" Type="CatalogVm" Href="http://localhost:9399/api/catalog/vms/fileserver01?format=Entity" Name="fileserver01" UID="urn:veeam:CatalogVm:fileserver01" VmDisplayName="fileserver01"> |
- Examine the received resource representation and find a link to the list of restore point for the given VM. Retrieve the URL for the VM restore points collection and send the GET HTTP request to the retrieved URL. The server will return a resource representation of the restore points collection:
Request: GET http://localhost:9399/api/catalog/vms/fileserver01/vmRestorePoints
Request Header: X-RestSvcSessionId: NDRjZmJkYmUtNWE5NS00MTU2LTg4NjctOTFmMDY5YjdjMmNj
Response: 200 Success
Response Body: <EntityReferences xmlns="http://www.veeam.com/ent/v1.0"> |
- Examine the received resource representation and find a link to the entity resource representation for the necessary VM restore point. Send the GET HTTP request to the retrieved URL. The server will return a resource representation of the selected restore point:
Request: GET http://localhost:9399/api/catalog/vms/fileserver01/vmRestorePoints/d2bfab92-7286-454e-ada5-55dd8146d462?format=Entity
Request Header: X-RestSvcSessionId: NDRjZmJkYmUtNWE5NS00MTU2LTg4NjctOTFmMDY5YjdjMmNj
Response: 200 Success
Response Body: <CatalogVmRestorePoint xmlns="http://www.veeam.com/ent/v1.0" Type="CatalogVmRestorePoint" Href="http://localhost:9399/api/catalog/vms/win-tw2/vmRestorePoints/d2bfab92-7286-454e-ada5-55dd8146d462?format=Entity" Name="fileserver01" UID="urn:veeam:CatalogVmRestorePoint:d2bfab92-7286-454e-ada5-55dd8146d462"> |
- Find a link to the browse action and send the POST HTTP request to the URL in the link. In response, Veeam Backup Enterprise Manager creates a new task and returns the HTTP/1.1 202 ACCEPTED status to the client. In the response body, Veeam Backup Enterprise Manager returns a resource representation of the task.
Request: POST http://localhost:9399/api/catalog/vms/fileserver01/vmRestorePoints/d2bfab92-7286-454e-ada5-55dd8146d462?action=browse
Request Header: X-RestSvcSessionId: NDRjZmJkYmUtNWE5NS00MTU2LTg4NjctOTFmMDY5YjdjMmNj
Response: 202 Created
Response Body: <Task xmlns="http://www.veeam.com/ent/v1.0" Type="Task" Href="http://localhost:9399/api/tasks/task-1"> |
- In the resource representation of the task, the server also returns a link to the VM guest OS file system. Send the GET HTTP request to the URL of the guest OS file system resource:
Request: GET http://localhost:9399/api/catalog/vms/fileserver01/vmRestorePoints/d2bfab92-7286-454e-ada5-55dd8146d462/guestfs
Request Header: X-RestSvcSessionId: NDRjZmJkYmUtNWE5NS00MTU2LTg4NjctOTFmMDY5YjdjMmNj
Response: 200 Success
Response Body: <FileSystemEntry xmlns="http://www.veeam.com/ent/v1.0"> |
- Construct the URL for the resource of the directory in which the file you plan to restore resides. The URL is constructed by the following pattern: /catalog/vms/{ID}/vmRestorePoints/{ID}/guestfs/{filepath}, where {filepath} is the path to the directory on the VM guest OS.
Send the GET HTTP request to the constructed URL:
Request: GET http://localhost:9399/api/catalog/vms/fileserver01/vmRestorePoints/d2bfab92-7286-454e-ada5-55dd8146d462/guestfs/C:/Documents
Request Header: X-RestSvcSessionId: NDRjZmJkYmUtNWE5NS00MTU2LTg4NjctOTFmMDY5YjdjMmNj
Response: 200 Success |
- The resource representation of the directory contains a set of links that allow you to perform the following actions:
- Display all entries, both files and subdirectories, in the directory
- Display all files in the directory
- Display all subdirectories in the directory
To get a list of all files, send the GET HTTP request to the /catalog/vms/{ID}/vmRestorePoints/{ID}/guestfs/(filepath}?action=listAll URL:
Request: GET http://localhost:9399/api/catalog/vms/fileserver01/vmRestorePoints/d2bfab92-7286-454e-ada5-55dd8146d462/guestfs/C:/Documents?action=listAll
Request Header: X-RestSvcSessionId: NDRjZmJkYmUtNWE5NS00MTU2LTg4NjctOTFmMDY5YjdjMmNj
Response: 200 Success
Response Body: <FileSystemEntries xmlns="http://www.veeam.com/ent/v1.0"> |
- Find a link to the restore action for the necessary file in the directory and send the POST HTTP request to the URL in the link. In response, Veeam Backup Enterprise Manager creates a new task and returns the HTTP/1.1 202 ACCEPTED status to the client. In the response body, Veeam Backup Enterprise Manager returns a resource representation of the task.
Request: POST http://localhost:9399/api/catalog/vms/fileserver01/vmRestorePoints/d2bfab92-7286-454e-ada5-55dd8146d462/guestfs/C:/Documents/Invoice1.docx?action=restore
Request Header: X-RestSvcSessionId: NDRjZmJkYmUtNWE5NS00MTU2LTg4NjctOTFmMDY5YjdjMmNj
Response: 202 Created
Response Body: <Task xmlns="http://www.veeam.com/ent/v1.0" Type="Task" Href="http://win-tw3:9399/api/tasks/task-1"> |
- Send the GET HTTP request to the task URL to learn about the task completion.
Request: GET http://localhost:9399/api/tasks/task-1
Request Header: X-RestSvcSessionId: NDRjZmJkYmUtNWE5NS00MTU2LTg4NjctOTFmMDY5YjdjMmNj
Response: 200 Success
Response Body: <Task xmlns="http://www.veeam.com/ent/v1.0" Type="Task" Href="http://win-tw3:9399/api/tasks/task-1"> |
Result
The file is restored to its initial location on the VM guest OS.