Performing Entire VM Restore
Using Veeam Backup Enterprise Manager REST API, you can perform the entire VM restore operation.
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 the necessary VM.
Procedure
- After you access Veeam Backup Enterprise Manager REST API and create a new logon session, examine the representation of the logon session that the server has returned:
Request: POST https://localhost:9398/api/sessionMngr/?v=v1_6
Request Header: Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=
Response: 201 Created
Response Header: X-RestSvcSessionId: NDRjZmJkYmUtNWE5NS00MTU2LTg4NjctOTFmMDY5YjdjMmNj
Response Body: <LogonSessions xmlns="http://www.veeam.com/ent/v1.0"> |
- Find the link for the /vmRestorePoints resource collection:
<Link Rel="Down" Type="VmRestorePointReferenceList" Href="https://localhost:9398/api/vmRestorePoints" /> |
- From the link, retrieve the URL for the /vmRestorePoints 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 VM restore points that have been created by backup servers connected to Veeam Backup Enterprise Manager.
Request: GET https://localhost:9398/api/vmRestorePoints
Request Header: X-RestSvcSessionId: NDRjZmJkYmUtNWE5NS00MTU2LTg4NjctOTFmMDY5YjdjMmNj
Response: 200 OK
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 restore point. The Rel attribute in the link is set to Alternate:
<Link Rel="Alternate" Type="VmRestorePoint" Href="https://localhost:9398/api/vmRestorePoints/a712861b-0dd3-405b-8b75-2fbee55fb415?format=Entity" Name="sql01-hv@2013-08-21 10:44:36" /> |
- Retrieve the URL for the VM restore point and send the GET HTTP request to the retrieved URL. The server will return a resource representation of the VM restore point:
Request: GET https://localhost:9398/api/vmRestorePoints/a712861b-0dd3-405b-8b75-2fbee55fb415?format=Entity
Request Header: X-RestSvcSessionId: NDRjZmJkYmUtNWE5NS00MTU2LTg4NjctOTFmMDY5YjdjMmNj
Response: 200 OK
Response Body: <VmRestorePoint xmlns="http://www.veeam.com/ent/v1.0" Type="VmRestorePoint" Href="https://localhost:9398/api/vmRestorePoints/a712861b-0dd3-405b-8b75-2fbee55fb415?format=Entity" Name="sql01-hv@2013-08-21 10:44:36" UID="urn:veeam:VmRestorePoint:a712861b-0dd3-405b-8b75-2fbee55fb415" VmDisplayName="sql01-hv"> |
- Find a link to the entire VM restore action and send the POST HTTP request to the URL in the link. The VM restore process is started asynchronously: Veeam Backup Enterprise Manager creates a new task for the VM restore 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 https://localhost:9398/api/vmRestorePoints/a712861b-0dd3-405b-8b75-2fbee55fb415?action=restore
Request Header: X-RestSvcSessionId: NDRjZmJkYmUtNWE5NS00MTU2LTg4NjctOTFmMDY5YjdjMmNj
Response: 202 Created
Response Body: <Task xmlns="http://www.veeam.com/ent/v1.0" Type="Task" Href="https://localhost:9398/api/tasks/task-1"> |
- Every task has its own ID. In the given example, the task ID is task-1. To track the task performance and check the task result, send the GET HTTP request to the task resource. The server will return a resource representation of the task describing the task status and result:
Request: GET https://localhost:9398/api/tasks/task-1
Request Header: X-RestSvcSessionId: NDRjZmJkYmUtNWE5NS00MTU2LTg4NjctOTFmMDY5YjdjMmNj
Response: 200 OK
Response Body: <Task xmlns="http://www.veeam.com/ent/v1.0" Type="Task" Href="https://localhost:9398/api/tasks/task-1"> |
- In the resource representation of the task, the server also returns a link to the restore session resource created once the restore process is started. You can check the restore session details by sending the GET HTTP request to the restore session resource:
Request: GET https://localhost:9398/api/restoreSessions/b67a3603-81f4-46af-be68-9f2c2307465c?format=Entity
Request Header: X-RestSvcSessionId: NDRjZmJkYmUtNWE5NS00MTU2LTg4NjctOTFmMDY5YjdjMmNj
Response: 200 OK
Response Body: <RestoreSession xmlns="http://www.veeam.com/ent/v1.0" Type="RestoreSession" Href="https://localhost:9398/api/restoreSessions/b67a3603-81f4-46af-be68-9f2c2307465c?format=Entity" Name="sql01-hv@2013-08-26 08:31:22" UID="urn:veeam:RestoreSession:b67a3603-81f4-46af-be68-9f2c2307465c" VmDisplayName="sql01-hv"> |
Result
The VM is restored from the backup to its initial location.