REST API - Sample Scenario: Restore

Updated

Using Commvault REST APIs, you can restore file system data obtained through a backup. This scenario covers in-place and out-of-place restore operations.

Prerequisites

  • Review the POST Retrieve to Client (Restore) API.

  • Use the POST Login API to request an authentication token and to retrieve the userGUID parameter.

  • Complete the steps in the Browse Using a Session ID scenario. You need values from the following APIs:

    • POST Client List API <subClient> element:

      clientId

      clientName

      applicationId

      instanceId

      backupsetId

      subclientId

    • POST Browse API:

      path attribute in the <dataResultSet> element

      backupTime attribute in the <advancedData> element (this is needed if you restore a specific version of a file)

In-Place Restore

Use this request to restore folders and files to their original path locations.

Send a POST retrieveToClient request with the restore information in the XML elements:

  • In the userGuid attribute in the <userInfo> element, include the user GUID retrieved using the POST Login API.

  • In the <srcContent> and <destination> elements, include the source and destination information identified in the POST Client List API.

  • Set the inPlace attribute in the <destination> element to 1 to restore the data to its original location on the client.

  • For each file to restore, add a <filePaths> element. Add the path identified in the POST Browse API to the <val> attribute in the <filePaths> element. Path values must appear exactly as shown in the POST Browse response.

For example:

POST SearchSvc/CVWebService.svc/retrieveToClient HTTP/1.1

Host: client.mydomain.com

Accept: application/xml

Authtoken: QSDK 38568012f4d1e8ee1841d283a47aa3ba78e124ea58354b5fc6

0f4dab8a63347d05cf5552484dafda3bfa4c5db84e580b1cb37bcf8e65b39f7f

8549a443e6f78a2c7be3f31b3d845e24776c835e498e8e883bb40c46bd15af4f

40ca94e823acedcdd4e9659e74b34a07a85c4586cd2ed914b6dce015874783ef7

68fda78183a4208930954a377f66eb56c8b92cexampl4s437a19317ca6ce7f323

3d5a01aca35dbad93468b833f2cf71010809006a937670adce711ca8be46638e8

Content-type: application/xml

<?xml version="1.0" encoding="UTF-8"?>

<DM2ContentIndexing_RetrieveToClientReq mode="2" serviceType="1">

  <userInfo userGuid="8DDB1E31-53B0-46B0-AE2D-A5E5FC5916DE"/>

  <header>

    <srcContent clientId="2" appTypeId="33" instanceId="1" backupSetId="31" subclientId="41"/>

    <destination clientId="2" clientName="devsrv" inPlace="1"/>

    <filePaths val="\C:\Sample Backup\testdata\data2\rc"/>

    <filePaths val="\C:\Sample Backup\testdata\data2\bottom_left.png"/>

  </header>

  <advanced restoreDataAndACL="1" restoreDeletedFiles="1"/>

</DM2ContentIndexing_RetrieveToClientReq>

All responses to restore requests return a job ID, for example, <DM2ContentIndexing_RetrieveToClientResp jobId="28075" />.

Out-of-Place Restore to the Same Client

Use this request to restore folders and files to a new location on the original client.

Send a POST retrieveToClient request with the restore information in the XML elements:

  • In the userGuid attribute in the <userInfo> element, include the user GUID retrieved using the POST Login API.

  • In the <srcContent> and <destination> elements, include the source and destination information identified in the POST Client List API.

  • Set the inPlace attribute in the <destination> element to 0 to restore the data to a new location.

  • In the val attribute in the <destPath> element, add the destination path. The data is restored to this destination path. If the new path does not exist on the client, the restore operation creates it.

  • For each file to restore, add a <filePaths> element. Add the path identified in the POST Browse API to the <val> attribute in the <filePaths> element. Path values must appear exactly as shown in the POST Browse response.

For example:

POST SearchSvc/CVWebService.svc/retrieveToClient HTTP/1.1

Host: client.mydomain.com

Accept: application/xml

Authtoken: QSDK 38568012f4d1e8ee1841d283a47aa3ba78e124ea58354b5fc6

0f4dab8a63347d05cf5552484dafda3bfa4c5db84e580b1cb37bcf8e65b39f7f

8549a443e6f78a2c7be3f31b3d845e24776c835e498e8e883bb40c46bd15af4f

40ca94e823acedcdd4e9659e74b34a07a85c4586cd2ed914b6dce015874783ef7

68fda78183a4208930954a377f66eb56c8b92cexampl4s437a19317ca6ce7f323

3d5a01aca35dbad93468b833f2cf71010809006a937670adce711ca8be46638e8

Content-type: application/xml

<?xml version="1.0" encoding="UTF-8"?>

<DM2ContentIndexing_RetrieveToClientReq mode="2" serviceType="1">

  <userInfo userGuid="8DDB1E31-53B0-46B0-AE2D-A5E5FC5916DE"/>

  <header>

    <srcContent clientId="2" appTypeId="33" instanceId="1" backupSetId="31" subclientId="41"/>

    <destination clientId="2" clientName="devsrv" inPlace="0">

      <destPath val="c:\restoretest\test1"/>

    </destination>

    <filePaths val="\c:\Sample Backup\testdata\data2\rc"/>

    <filePaths val="\c:\Sample Backup\testdata\data2\bottom_left.png"/>

  </header>

  <advanced restoreDataAndACL="1" restoreDeletedFiles="1"/>

</DM2ContentIndexing_RetrieveToClientReq>

All responses to restore requests return a job ID, for example, <DM2ContentIndexing_RetrieveToClientResp jobId="28075" />.

Out-of-Place Restore to a Different Client

Use this request to restore folders and files to a different client.

Send a POST retrieveToClient request with the restore information in the XML elements:

  • In the userGuid attribute in the <userInfo> element, include the user GUID retrieved using the POST Login API.

  • In the <srcContent>, include the source information identified in the POST Client List API.

  • In the <destination> elements, include the destination client information. This should not match the client information in the <srcContent> element since this restore is to a different client.

  • Set the inPlace attribute in the <destination> element to 0 to restore the data to a new location.

  • In the val attribute in the <destPath> element, add the destination path. The data is restored to this destination path. If the new path does not exist on the client, the restore operation creates it.

  • For each file to restore, add a <filePaths> element. Add the path identified in the POST Browse API to the <val> attribute in the <filePaths> element. Path values must appear exactly as shown in the POST Browse response.

For example:

POST SearchSvc/CVWebService.svc/retrieveToClient HTTP/1.1

Host: client.mydomain.com

Accept: application/xml

Authtoken: QSDK 38568012f4d1e8ee1841d283a47aa3ba78e124ea58354b5fc6

0f4dab8a63347d05cf5552484dafda3bfa4c5db84e580b1cb37bcf8e65b39f7f

8549a443e6f78a2c7be3f31b3d845e24776c835e498e8e883bb40c46bd15af4f

40ca94e823acedcdd4e9659e74b34a07a85c4586cd2ed914b6dce015874783ef7

68fda78183a4208930954a377f66eb56c8b92cexampl4s437a19317ca6ce7f323

3d5a01aca35dbad93468b833f2cf71010809006a937670adce711ca8be46638e8

Content-type: application/xml

<?xml version="1.0" encoding="UTF-8"?>

<DM2ContentIndexing_RetrieveToClientReq mode="2" serviceType="1">

  <userInfo userGuid="8DDB1E31-53B0-46B0-AE2D-A5E5FC5916DE"/>

  <header>

    <srcContent clientId="2" appTypeId="33" instanceId="1" backupSetId="31" subclientId="41"/>

    <destination clientId="4" clientName="devsrv10" inPlace="0">

      <destPath val="c:\restoretest\test1"/>

    </destination>

    <filePaths val="\c:\Sample Backup\testdata\data2\rc"/>

    <filePaths val="\c:\Sample Backup\testdata\data2\bottom_left.png"/>

  </header>

  <advanced restoreDataAndACL="1" restoreDeletedFiles="1"/>

</DM2ContentIndexing_RetrieveToClientReq>

All responses to restore requests return a job ID, for example, <DM2ContentIndexing_RetrieveToClientResp jobId="28075" />.

Restore Options

The following options are available for all restore operations.

Overwriting Existing Files

To overwrite files that exist on the destination client, send a POST retrieveToClient request with the unconditionalOverwrite attribute in the <advanced> element set to 1.

For example:

POST SearchSvc/CVWebService.svc/retrieveToClient HTTP/1.1

Host: client.mydomain.com

Accept: application/xml

Authtoken: QSDK 38568012f4d1e8ee1841d283a47aa3ba78e124ea58354b5fc6

0f4dab8a63347d05cf5552484dafda3bfa4c5db84e580b1cb37bcf8e65b39f7f

8549a443e6f78a2c7be3f31b3d845e24776c835e498e8e883bb40c46bd15af4f

40ca94e823acedcdd4e9659e74b34a07a85c4586cd2ed914b6dce015874783ef7

68fda78183a4208930954a377f66eb56c8b92cexampl4s437a19317ca6ce7f323

3d5a01aca35dbad93468b833f2cf71010809006a937670adce711ca8be46638e8

Content-type: application/xml

<?xml version="1.0" encoding="UTF-8"?>

<DM2ContentIndexing_RetrieveToClientReq mode="2" serviceType="1">

  <userInfo userGuid="8DDB1E31-53B0-46B0-AE2D-A5E5FC5916DE"/>

  <header>

    <srcContent clientId="2" appTypeId="33" instanceId="1" backupSetId="31" subclientId="41"/>

    <destination clientId="2" clientName="devsrv" inPlace="1"/>

    <filePaths val="\c:\Sample Backup\testdata\data2\rc"/>

    <filePaths val="\c:\Sample Backup\testdata\data2\bottom_left.png"/>

  </header>

  <advanced unconditionalOverwrite="1" restoreDataAndACL="1" restoreDeletedFiles="1"/>

</DM2ContentIndexing_RetrieveToClientReq>

Restoring Specific Versions of Files

To restore a specific version of a file instead of the latest backed up version, send a POST retrieveToClient request with a timestamp in the toTime attribute in the <srcContent> element.

To find the timestamp for the correct version, send a POST Browse request with the opType attribute in the <databrowse_BrowseRequest> element set to 2. In the POST Browse response, use the value in the backupTime attribute in the <advancedData> element as the timestamp for the POST retrieveToClient request.

For example:

POST SearchSvc/CVWebService.svc/retrieveToClient HTTP/1.1

Host: client.mydomain.com

Accept: application/xml

Authtoken: QSDK 38568012f4d1e8ee1841d283a47aa3ba78e124ea58354b5fc6

0f4dab8a63347d05cf5552484dafda3bfa4c5db84e580b1cb37bcf8e65b39f7f

8549a443e6f78a2c7be3f31b3d845e24776c835e498e8e883bb40c46bd15af4f

40ca94e823acedcdd4e9659e74b34a07a85c4586cd2ed914b6dce015874783ef7

68fda78183a4208930954a377f66eb56c8b92cexampl4s437a19317ca6ce7f323

3d5a01aca35dbad93468b833f2cf71010809006a937670adce711ca8be46638e8

Content-type: application/xml

<?xml version="1.0" encoding="UTF-8"?>

<DM2ContentIndexing_RetrieveToClientReq mode="2" serviceType="1">

  <userInfo userGuid="D2A3628E-9902-4CA4-A949-764B6B72283A"/>

  <header>

    <srcContent clientId="2" appTypeId="33" instanceId="1" backupSetId="3" subclientId="2" toTime="1379977369"/>

    <destination clientId="2" clientName="lumen" inPlace="1"/>

    <filePaths val="C:\Sample Backup\Test Data\versionstest.txt"/>

  </header>

  <advanced unconditionalOverwrite="1" restoreDataAndACL="1" restoreDeletedFiles="1"/>

</DM2ContentIndexing_RetrieveToClientReq>