FLR with keep/overwrite setting

RESTful knowledge exchange

FLR with keep/overwrite setting

Veeam Logoby Andreas Neufert » Mon Dec 05, 2016 10:07 am

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

I think this will overwrite the file. Is it somehow possible to "keep" the existing file?
Andreas Neufert
Veeam Software
 
Posts: 2201
Liked: 360 times
Joined: Wed May 04, 2011 8:36 am
Location: Germany
Full Name: @AndyandtheVMs Veeam PM

Re: FLR with keep/overwrite setting

Veeam Logoby v.Eremin » Mon Dec 05, 2016 4:39 pm

v.Eremin
Veeam Software
 
Posts: 13266
Liked: 968 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: FLR with keep/overwrite setting

Veeam Logoby cdesch » Tue Dec 06, 2016 1:54 pm

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
cdesch
Veeam ProPartner
 
Posts: 19
Liked: 6 times
Joined: Wed Jul 06, 2016 11:25 am
Full Name: Christian Desch

Re: FLR with keep/overwrite setting

Veeam Logoby tdewin » Wed Dec 07, 2016 5:01 pm

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.
tdewin
Veeam Software
 
Posts: 1043
Liked: 361 times
Joined: Fri Mar 02, 2012 1:40 pm
Full Name: Timothy Dewin

Re: FLR with keep/overwrite setting

Veeam Logoby phil » Thu Dec 08, 2016 2:45 pm

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
phil
Novice
 
Posts: 3
Liked: never
Joined: Thu Dec 08, 2016 2:25 pm
Location: Switzerland
Full Name: philipp

Re: FLR with keep/overwrite setting

Veeam Logoby tdewin » Fri Dec 09, 2016 9:39 am 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.
tdewin
Veeam Software
 
Posts: 1043
Liked: 361 times
Joined: Fri Mar 02, 2012 1:40 pm
Full Name: Timothy Dewin


Return to RESTful API



Who is online

Users browsing this forum: No registered users and 2 guests