RESTful knowledge exchange
Post Reply
Andreas Neufert
VP, Product Management
Posts: 6748
Liked: 1408 times
Joined: May 04, 2011 8:36 am
Full Name: Andreas Neufert
Location: Germany
Contact:

FLR with keep/overwrite setting

Post by Andreas Neufert »

https://helpcenter.veeam.com/backup/res ... epath.html

I think this will overwrite the file. Is it somehow possible to "keep" the existing file?
veremin
Product Manager
Posts: 20284
Liked: 2258 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: FLR with keep/overwrite setting

Post by veremin »

cdesch
Veeam ProPartner
Posts: 20
Liked: 7 times
Joined: Jul 06, 2016 11:25 am
Full Name: Christian Desch
Contact:

Re: FLR with keep/overwrite setting

Post by cdesch »

Hi all,

sorry, i'm not 100% familiar with python http request, but how could i pass the Special flag "<ToOriginalLocation Overwrite="false">, which is in XML form, into the python HTTP POST "action=restore" request ?
Could you please give me an example ?

thx Chris
tdewin
Veeam Software
Posts: 1775
Liked: 646 times
Joined: Mar 02, 2012 1:40 pm
Full Name: Timothy Dewin
Contact:

Re: FLR with keep/overwrite setting

Post by tdewin »

Well posting data depends on the python framework you are using. Maybe interesting to look at is the external stack overflow response : http://stackoverflow.com/questions/1250 ... ts-library

Basically it says you can pass the argument in the data parameter (not passing a dictionary). In the end you need to pass the xml as the post body request (but again that depends on the framework you are using)

Copy paste if ever the link expires:

Code: Select all

import requests

xml = """<?xml version='1.0' encoding='utf-8'?>
<a>б</a>"""
headers = {'Content-Type': 'application/xml'} # set what your server accepts
print requests.post('http://httpbin.org/post', data=xml, headers=headers).text
Please let us know if this works, it might be handy for other forum users.
phil
Novice
Posts: 3
Liked: never
Joined: Dec 08, 2016 2:25 pm
Full Name: philipp
Location: Switzerland
Contact:

Re: FLR with keep/overwrite setting

Post by phil »

hi together

Where in documentation can i find hints for "<ToOriginalLocation Overwrite="false">" ? (default, without parameters, it restore in a separate folder like "www.RESTORED-20161208152511"), i only found in other restore-documentation this value:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<FileRestoreSpec xmlns="http://www.veeam.com/ent/v1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <ToOriginalLocation/>
</FileRestoreSpec>
but this doesn't work in the catalog-restore.

in the restore-documentation for "(POST) /catalog/vms/{vmname}/vmRestorePoints /{ID}/guestfs/{filepath}?action=restore" i didn't find any overwrite option, only in:
(POST) /vmReplicaPoints/{ID}/mounts/{ID}/{filepath}?action=restore
(POST) /vmRestorePoints/{ID}/mounts/{ID}/{filepath}?action=restore

is there any way to define "overwrite the existing folder" with the restore-data?

thx
phil
tdewin
Veeam Software
Posts: 1775
Liked: 646 times
Joined: Mar 02, 2012 1:40 pm
Full Name: Timothy Dewin
Contact:

Re: FLR with keep/overwrite setting

Post by tdewin » 1 person likes this post

You can find the information from the restapi xsd. Normally it should be somewhere in the install directory under "\Veeam\Backup and Replication\Enterprise Manager\schemas\RestAPI.xsd". In my case "C:\Program Files\Veeam\Backup and Replication\Enterprise Manager\schemas\RestAPI.xsd" . Granted it is quite hard to read at times but it is has all the options available

There you can look up the type "FileRestoreSpecType". It contains an element ToOriginalLocation (notice choice between this and ForDirectDownload). ToOrignalLocation is another type which can be also looked up

Code: Select all

  <xs:complexType name="FileRestoreSpecType">
    <xs:complexContent>
      <xs:extension base="SpecType">
        <xs:choice>
          <xs:element name="ToOriginalLocation" type="FileRestoreToOriginalSpecInfoType" />
          <xs:element name="ForDirectDownload">
            <xs:complexType />
          </xs:element>
        </xs:choice>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
It has an element credentials, which you may ore may not supply and It has an attribute Overwrite which is optional but has a default value of false.

Code: Select all

  <xs:complexType name="FileRestoreToOriginalSpecInfoType">
    <xs:complexContent>
      <xs:extension base="InfoType">
        <xs:sequence>
          <xs:element name="GuestCredentials" type="PlainCredentialsType" maxOccurs="1" minOccurs="0" />
        </xs:sequence>
        <xs:attribute name="Overwrite" type="bool" use="optional" default="false" />
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
Although I must say that it is explained quite in details here : https://helpcenter.veeam.com/docs/backu ... tml?ver=95

but you do seem to be right that for a catalog restore, there is no accepted "body" or "spec", thus you are only limited to do a restore without any additional options. What you could do is use the catalog to find out the files you need, and then reuse the plain restore to do the actual restore (and supply the options). In the end this is what the API is doing as well. When the restore happens, it also has to mount the backup.
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests