RESTful knowledge exchange
Post Reply
abqstu
Influencer
Posts: 11
Liked: never
Joined: Aug 27, 2013 11:37 am
Contact:

Backup results

Post by abqstu »

Hi

I'm trying to retrieve the results of backup operations using the REST API.

At the moment I'm using the (GET) /backupTaskSessions call and this returns a list of all the backups ever done for every virtual machine. I then have to parse these results to find the ones I'm interested in, using the VmDisplayName attribute of the BackupTaskSession tag to know which machine each result relates to. Obviously this returns a lot of results I'm not interested in and will return more and more data over time.

Is there any way to get the results for a specific virtual machine (or even better a list of virtual machines) or to limit the results returned by start and/or end date ?

Thanks
Stuart
nefes
Veeam Software
Posts: 643
Liked: 162 times
Joined: Dec 10, 2012 8:44 am
Full Name: Nikita Efes
Contact:

Re: Backup results

Post by nefes »

You can use /querySvc to search sessions with certain parameters.
More details about query syntax can be found here.
abqstu
Influencer
Posts: 11
Liked: never
Joined: Aug 27, 2013 11:37 am
Contact:

Re: Backup results

Post by abqstu »

Thanks. That's just what I was looking for.
One more question - the filter and sort fields appear to work only with the attributes of the main tag (the BackupTaskSession tag in my case). Is it possible to use the values of sub tags to filter or sort the results ?
For example, the BackupTaskSession tag has a Result sub tag - is it possible to just retrieve results where the value of the Result tag is Success ?
nefes
Veeam Software
Posts: 643
Liked: 162 times
Joined: Dec 10, 2012 8:44 am
Full Name: Nikita Efes
Contact:

Re: Backup results

Post by nefes »

Yes, you can do it. Just make a filter like: filter=(Result=="Success")
abqstu
Influencer
Posts: 11
Liked: never
Joined: Aug 27, 2013 11:37 am
Contact:

Re: Backup results

Post by abqstu »

Okay. That seems to work with some fields but not with others.
The example you give works okay, but if I try the CreationTimeUTC or EndTimeUTC fields, I get a 400 error with the message "Incorrect field name: CreationTimeUTC"
nefes
Veeam Software
Posts: 643
Liked: 162 times
Joined: Dec 10, 2012 8:44 am
Full Name: Nikita Efes
Contact:

Re: Backup results

Post by nefes »

You can view all implemented filter parameters at corresponding section of the guide, for example http://helpcenter.veeam.com/backup/70/r ... ns_id.html for Backup Task Session.
All other parameters also may work, but it was not specially tested so you can see error message like that one.
If you think that some other parameter for querying should be implemented - here is the best place to tell us about it.
Could you please specify a scenario where you need CreationTimeUTC or EndTimeUTC fields to be queryable?
abqstu
Influencer
Posts: 11
Liked: never
Joined: Aug 27, 2013 11:37 am
Contact:

Re: Backup results

Post by abqstu »

I was looking to restrict how many results I get back by date. i.e. only results after the given date will be returned.
I notice that the parameter names for the two fields (CreationTime and EndTime) are different to the XML tag names (CreationTimeUTC and EndTimeUTC) which is what I had been using in the filter.
However, if I do use CreationTime or EndTime in the filter I then get a 500 error with a System.NotImplementedException in the stacktrace. The documentation shows True in the 'Can Be Used For Filtering' column for those parameters.
nefes
Veeam Software
Posts: 643
Liked: 162 times
Joined: Dec 10, 2012 8:44 am
Full Name: Nikita Efes
Contact:

Re: Backup results

Post by nefes »

I am sorry for inattention! What you've found is definitely a bug, we will fix it in one of upcoming releases.
abqstu
Influencer
Posts: 11
Liked: never
Joined: Aug 27, 2013 11:37 am
Contact:

Re: Backup results

Post by abqstu »

No problem.
Thanks for your help.
Cathy
Influencer
Posts: 16
Liked: never
Joined: Jun 13, 2014 3:48 am
Full Name: Cathy Hu
Contact:

Re: Backup results

Post by Cathy »

May I know this issue is fixed in which patch? Or fixed in Veeam B&R v.8?
I reviewed release notes of each patches but can't find it.
foggy
Veeam Software
Posts: 21069
Liked: 2115 times
Joined: Jul 11, 2011 10:22 am
Full Name: Alexander Fogelson
Contact:

Re: Backup results

Post by foggy »

Cathy, this was supposed to be fixed in Patch 3, probably just was not included in the list of fixes.
Cathy
Influencer
Posts: 16
Liked: never
Joined: Jun 13, 2014 3:48 am
Full Name: Cathy Hu
Contact:

Re: Backup results

Post by Cathy »

We updated patch 4 and it worked well. Thanks.
foggy
Veeam Software
Posts: 21069
Liked: 2115 times
Joined: Jul 11, 2011 10:22 am
Full Name: Alexander Fogelson
Contact:

Re: Backup results

Post by foggy »

Thanks for confirming, much appreciated.
Cathy
Influencer
Posts: 16
Liked: never
Joined: Jun 13, 2014 3:48 am
Full Name: Cathy Hu
Contact:

Re: Backup results

Post by Cathy »

After we updated patch 4, filter by time could work. However, we found if we use JobName or JobUid to filter, we get success return with null list.
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Backup results

Post by veremin »

You mean when you try to query backuptasksessions, using JobName or JobUID as filter, nothing is returned? Thanks.
Cathy
Influencer
Posts: 16
Liked: never
Joined: Jun 13, 2014 3:48 am
Full Name: Cathy Hu
Contact:

Re: Backup results

Post by Cathy »

Yes!
We use query?type=BackupTaskSession&format=entities&filter=(JobName==myTest) and get 200 OK with null list.
However, we change to use powershell Get-VBRBackupSession -Name "myTest" could get correct return.
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Backup results

Post by veremin »

In fact, Backup session and Backup Task session are two different entities. If you want to get Backup sessions, you have to query "/BackupSessions" resource, not "/BackupTaskSessions" one. Thanks.
Cathy
Influencer
Posts: 16
Liked: never
Joined: Jun 13, 2014 3:48 am
Full Name: Cathy Hu
Contact:

Re: Backup results

Post by Cathy »

Yes, we know "The /backupTaskSession resource provides information about a specific task within a backup job session." Backup session and Backup Task session are different.
However, we only use powershell to prove there is a backup job there with JobName=myTest.
powershell:: Get-VBRBackupSession –Name “myTest”|Get-VBRTaskSession did return correct data.
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Backup results

Post by veremin »

My point was that BackupTaskSession doesn't seem to support JobName or JodUID as querying parameters. And if you want to use them, you should query the higher entity - BackupJobSession. Thanks.
Cathy
Influencer
Posts: 16
Liked: never
Joined: Jun 13, 2014 3:48 am
Full Name: Cathy Hu
Contact:

Re: Backup results

Post by Cathy »

http://helpcenter.veeam.com/backup/70/r ... ns_id.html
I think (GET)/backupTaskSessions/ should support JobName or JobUid as querying parameters. Or it would not return 200OK.
We want to get VM's restore point and its backup result(for each restore point) in a specific backup JOB. That is why we need to use JobName or JobUid as querying parameter.
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Backup results

Post by veremin »

After having investigated this behavior further, it was confirmed that backupTaskSession entity should accept JobName and JobUID as querying parameters (thus, the documentation). However, currently it doesn't work that way. So, we tracked that as a bug. Chances are, it will be fixed in the upcoming release. Thanks.
Cathy
Influencer
Posts: 16
Liked: never
Joined: Jun 13, 2014 3:48 am
Full Name: Cathy Hu
Contact:

Re: Backup results

Post by Cathy »

One more thing about query:
We would get 400 error from query?type=restoreSession&format=Entities&sortAsc=name&filter=(VmDisplayName=="vse-in1 (13638542-3fcd-4ebf-a75d-ccf502970f6b)-0"),(VmDisplayName=="vse-in2 (3c07ee1c-66de-4a6f-b086-c68ca215d117)-0"),(VmDisplayName=="win2008-sch (9abc15fc-2a98-463b-a9e4-889e71fbc21d)")

However, it would return 200 OK if we only set 2 VMDisplayName. ex: query?type=restoreSession&format=Entities&sortAsc=name&filter=(VmDisplayName=="vse-in1 (13638542-3fcd-4ebf-a75d-ccf502970f6b)-0"),(VmDisplayName=="vse-in2 (3c07ee1c-66de-4a6f-b086-c68ca215d117)-0")

Just want to make sure we could only set 2 VMDisplayname filter. (Can't set 3 or more VMDisplayname filter.) Or maybe our restful API strings are too long.
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Backup results

Post by veremin »

I wasn't able to confirm that. I've just query /restoresssions, using three different VM names as a filter, and everything's worked as expected.

Code: Select all

query?type=RestoreSession&format=Entities&sortAsc=name&filter=(VMDisplayName=="First VM"), (VMDisplayName=="Second VM"), (VMDisplayName=="Third VM")
Thanks.
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests