REST API - Sample Scenario: Browse Using a Session ID

Updated

Using Commvault REST APIs, you can browse data obtained through a backup.

Prerequisite

Requesting Client Information

Use this request to return the default backup set and its corresponding default subclient for each client you own.

  1. Send a POST Client List request with the filter parameters in the <filter> element. Setting the getFsLikeClients attribute to "1" returns clients with file system agents. For example:

    POST SearchSvc/CVWebService.svc/LapTopClientList HTTP/1.1

    Host: client.mydomain.com

    Accept: application/xml

    Authtoken: QSDK 38568012f4d1e8ee1841d283a47aa3ba78e124ea58354b5fc6

    0f4dab8a63347d05cf5552484dafda3bfa4c5db84e580b1cb37bcf8e65b39f7f

    8549a443e6f78a2c7be3f31b3d845e24776c835e498e8e883bb40c46bd15af4f

    40ca94e823acedcdd4e9659e74b34a07a85c4586cd2ed914b6dce015874783ef7

    68fda78183a4208930954a377f66eb56c8b92cexampl4s437a19317ca6ce7f323

    3d5a01aca35dbad93468b833f2cf71010809006a937670adce711ca8be46638e8

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

    <App_LapTopClientListReq scope="2">

      <filter getAllProperties="0" getContent="0" getSchedules="0" getFsLikeClients="1" getMailBoxClients="0" getSharePointClients="0" getVMs="0"/>

    </App_LapTopClientListReq>
  2. In the response body, find the <subClient> element for the subclient you will send in the POST Browse request. The <subClient> element contains the client ID, client name, application ID, instance ID, backup set ID, and subclient ID needed for the POST Browse request. For example:

    <App_LapTopClientLstResp>

      <clientsFileSystem backupSize="128575" capabilities="34359742464" isOwner="1" totalBackupSize="128575" isVMArchived="0" isSyncUserProfilePresent="0" isDecoupledContent="0" isSyncAllowed="0" subclientStatus="8" clientStatus="0" isDLPEnabledOnClient="0" dirDelim="\">

        <lastBackupTime time="1385164989" _type_="55" />

        <lastSuccessBackupTime time="1385164989" _type_="55" />

        <lastOnlineTime time="1385410182" _type_="55" />

        <lastOfflineTime time="0" _type_="55" />

        <nextBackupTime time="1385420400" _type_="55" />

        <subClient _type_="7" applicationId="33" subclientId="2" instanceId="1" clientId="2" backupsetId="3" clientName="client001" hostName="DOCLABHVHOST.commcell.com" />

      </clientsFileSystem>

    </App_LapTopClientLstResp>

Browsing at the Root Level

Use this request to return all paths containing backed up data.

  1. Send a POST Browse request with the browse information in the XML elements. In the path attribute in the <paths> element, include a backslash (\). In the <entity> element, include the subclient information identified in the POST Client List API. For example:

    POST SearchSvc/CVWebService.svc/DoBrowse 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"?>

    <databrowse_BrowseRequest opType="browse">

      <entity clientName="client001" applicationId="33" clientId="2" subclientId="2" backupsetId="3" instanceId="1"/>

      <paths path="\"/>

      <options showDeletedFiles="1" restoreIndex="1"/>

      <mode mode="2"/>

      <queries type="1" queryId="countQuery">

        <aggrParam aggrType="4" field="0"/>

      </queries>

      <queries type="0" queryId="dataQuery">

        <dataParam>

          <paging firstNode="0" skipNode="0" pageSize="15"/>

          <sortParam ascending="1">

            <sortBy val="38"/>

            <sortBy val="0"/>

          </sortParam>

        </dataParam>

      </queries>

    </databrowse_BrowseRequest>
  2. In the response body, find the sessionId attribute in the <session> element. For example:

    <databrowse_BrowseResponseList>

      <browseResponses respType="0" workerId="44">

        <session sessionId="1385414910-44" />

        <browseResult queryId="dataQuery">

          <dataResultSet displayName="C:" modificationTime="1384805941" name="|2|#12!C:" path="\C:" size="122667" displayPath="\C:">

            <advancedData archiveFileId="853" archiveGroupId="6" backupJobId="1151" backupTime="1385164640" cipId="0" imageMap="1151 IN " offset="6768" referenceTime="1385164640">

              <browseMetaData>

                <dmStubData guid="cvlt_7e5744cdbcf146a1a6748168db00ede1" />

                <indexing folderSize="122667" />

                <securityData securityInfo="A&lt;S-1-5-18|1f01ff&gt;A&lt;S-1-5-32-544|1f01ff&gt;A&lt;S-1-5-32-545|1200a9&gt;A&lt;S-1-5-32-545|4&gt;A&lt;S-1-5-32-545|2&gt;A&lt;S-1-3-0|10000000&gt;" />

                <fsData DriveFreePercentage="8" />

              </browseMetaData>

              <sourceCommServer _type_="1" commCellId="2" type="0" />

              <subclient _type_="7" applicationId="2" />

              <advConfig>

                <browseAdvancedConfigResp commcellNumber="721050" />

              </advConfig>

            </advancedData>

            <flags directory="1" mountPoint="1" />

          </dataResultSet>

        </browseResult>

      </browseResponses>

      <browseResponses respType="0" workerId="44">

        <session sessionId="1385414910-44" />

        <browseResult queryId="countQuery">

          <aggrResultSet result="1" />

        </browseResult>

      </browseResponses>

    </databrowse_BrowseResponseList>

Browsing with a Session ID

When the initial root browse was requested, a unique browse session ID was created. The browse session ID is used to improve the response time of subsequent browse requests if you are changing paths, changing paging, or sorting parameters. Do not use the browse session ID when other parameters change: time range, show deleted items flag, search parameters, or mode.

  1. Change the root level POST Browse request by adding the session ID to the sessionId attribute in the <session> element and a new path to the path attribute in the <paths> element. For example:

    POST SearchSvc/CVWebService.svc/DoBrowse 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"?>

    <databrowse_BrowseRequest opType="browse">

      <session sessionId="1385414910-44" />

      <entity clientName="client001" applicationId="33" clientId="2" subclientId="2" backupsetId="3" instanceId="1"/>

      <paths path="c:\users"/>

      <options showDeletedFiles="1" restoreIndex="1"/>

      <mode mode="2"/>

      <queries type="1" queryId="countQuery">

        <aggrParam aggrType="4" field="0"/>

      </queries>

      <queries type="0" queryId="dataQuery">

        <dataParam>

          <paging firstNode="0" skipNode="0" pageSize="15"/>

          <sortParam ascending="1">

            <sortBy val="38"/>

            <sortBy val="0"/>

          </sortParam>

        </dataParam>

      </queries>

    </databrowse_BrowseRequest>
  2. In the response body, note the sessionId attribute in the <session> element matches the session ID in your request. Review each <dataResultSet> element to see the results of browsing the new path. For example:

    <databrowse_BrowseResponseList>

      <browseResponses respType="0" workerId="44">

        <session sessionId="1385414910-44" />

        <browseResult queryId="dataQuery">

          <dataResultSet displayName="admin" modificationTime="1383155548" name="|21|#12!admin" path="\C:\Users\admin" size="1008" displayPath="\C:\Users\admin">

            <advancedData archiveFileId="853" archiveGroupId="6" backupJobId="1151" backupTime="1385164640" cipId="0" imageMap="1151 IN " offset="27236" referenceTime="1385164640">

              <browseMetaData>

                <dmStubData guid="cvlt_8506089da446740b915fe7802ddcbf67" />

                <indexing folderSize="1008" />

                <securityData securityInfo="A&lt;S-1-5-18|1f01ff&gt;A&lt;S-1-5-32-544|1f01ff&gt;A&lt;S-1-5-21-3393418607-3554941549-4209072599-1105|1f01ff&gt;" />

              </browseMetaData>

              <sourceCommServer _type_="1" commCellId="2" type="0" />

              <subclient _type_="7" applicationId="2" />

              <advConfig>

                <browseAdvancedConfigResp commcellNumber="721050" />

              </advConfig>

            </advancedData>

            <flags directory="1" />

          </dataResultSet>

          <dataResultSet displayName="Administrator" modificationTime="1377895252" name="|4|#12!Administrator" path="\C:\Users\Administrator" size="121659" displayPath="\C:\Users\Administrator">

            <advancedData archiveFileId="853" archiveGroupId="6" backupJobId="1151" backupTime="1385164640" cipId="0" imageMap="1151 IN " offset="0" referenceTime="1385164640">

              <browseMetaData>

                <dmStubData guid="cvlt_605a1ecd61cadc0d834ee7c055a744cd" />

                <indexing folderSize="121659" />

                <securityData securityInfo="A&lt;S-1-5-18|1f01ff&gt;A&lt;S-1-5-32-544|1f01ff&gt;A&lt;S-1-5-21-555860399-384967793-3212812041-500|1f01ff&gt;" />

              </browseMetaData>

              <sourceCommServer _type_="1" commCellId="2" type="0" />

              <subclient _type_="7" applicationId="2" />

            </advancedData>

            <flags directory="1" />

          </dataResultSet>

        </browseResult>

      </browseResponses>

      <browseResponses respType="0" workerId="44">

        <session sessionId="1385414910-44" />

        <browseResult queryId="countQuery">

          <aggrResultSet result="2" />

        </browseResult>

      </browseResponses>

    </databrowse_BrowseResponseList>