REST API knowledge exchange
Post Reply
pwinkeler
Influencer
Posts: 18
Liked: 2 times
Joined: Aug 17, 2017 3:48 pm
Full Name: Paul Winkeler
Contact:

Retrieve sessions for Backup Copy Jobs

Post by pwinkeler »

There does not appear to be a specific JobType for this and using 'BackupJobSession' as the Type for a job that has JobType ImmediateBackupCopy yields zero (0) results?! How do I retrieve the sessions of a ImmediateBackupCopy job?
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Retrieve sessions for Backup Copy Jobs

Post by oleg.feoktistov »

Hi Paul,

Are you talking about v11 or v11a?

Thanks,
Oleg
pwinkeler
Influencer
Posts: 18
Liked: 2 times
Joined: Aug 17, 2017 3:48 pm
Full Name: Paul Winkeler
Contact:

Re: Retrieve sessions for Backup Copy Jobs

Post by pwinkeler »

Hi Oleg - running version 11.0.1.1261 which I believe is plain Jane 11.
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Retrieve sessions for Backup Copy Jobs

Post by oleg.feoktistov »

Paul,

It is v11a. Checked in my lab, sessions of ImmediateBackupCopy job type are showing up there. Could you, please, elaborate on the queries you send?

Thanks,
Oleg
pwinkeler
Influencer
Posts: 18
Liked: 2 times
Joined: Aug 17, 2017 3:48 pm
Full Name: Paul Winkeler
Contact:

Re: Retrieve sessions for Backup Copy Jobs

Post by pwinkeler »

Hi Oleg - I can try setting the JobType to ImmediateBackupCopy: note that that value is not listed as an option in the API documentation which is why I did not try it (yet). Thanks!
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Retrieve sessions for Backup Copy Jobs

Post by oleg.feoktistov »

Yes, that is what works with query service. GET /jobs/{id}/backupSessions on immediate backup copy jobs show sessions as well. Please give it a try and let me know. Meanwhile, I'll check with the documentation team. Thanks!
pwinkeler
Influencer
Posts: 18
Liked: 2 times
Joined: Aug 17, 2017 3:48 pm
Full Name: Paul Winkeler
Contact:

Re: Retrieve sessions for Backup Copy Jobs

Post by pwinkeler »

Ah wait, I am using the query service with this URL: query?type=BackupJobSession&format=entities&filter=JobName=="PowerSchool - Tuesday Group - Offsite";EndTime>="2022-06-14T13:45:18Z" where the job with that name is of type ImmediateBackupCopyJob and I get zero (0) results.
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Retrieve sessions for Backup Copy Jobs

Post by oleg.feoktistov »

I think I understand what is the issue. Due to the backup copy immediate mode's architecture, sessions of ImmediateBackupCopy job type don't have EndTime property set correctly (it is in the past - 1/1/1900 12:00:00 AM). Such sessions contain general data on backup copy job initialization and stats for the last 24 hours or so. To use EndTime filter for immediate backup copy mode, you need to query worker sessions (which actually have EndTime set correctly) instead. In the query type you are using rest service initiates search among all job types, but ends up with nothing because worker sessions have also their own naming convention: BackupCopyJobName\SourceJobName.

So there appears to be 2 ways to make your query work with EndTime.
Query by job name with job worker name convention:

Code: Select all

/query?type=BackupJobSession&format=entities&filter=JobName=="BackupCopyJob\SourceJob";EndTime>="2022-06-14T13:45:18Z"
Query by job type:

Code: Select all

/query?type=BackupJobSession&format=entities&filter=JobType==ImmediateBackupCopyWorker;EndTime>="2022-06-14T13:45:18Z"

Or you can query ImmediateBackupCopy sessions omitting EndTime parameter.

Best regards,
Oleg
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Retrieve sessions for Backup Copy Jobs

Post by oleg.feoktistov »

As for the job type list available in the helpcenter, I asked our documentation team to update the article on BackupJobSession query. Thanks!
pwinkeler
Influencer
Posts: 18
Liked: 2 times
Joined: Aug 17, 2017 3:48 pm
Full Name: Paul Winkeler
Contact:

Re: Retrieve sessions for Backup Copy Jobs

Post by pwinkeler »

Thanks for those insights Oleg; since I have several of these copy sessions in any 24 hour period I will try to narrow the query down by referencing the source job name. That'll be fun :-)
I'll let you know of my success with that approach here.
pwinkeler
Influencer
Posts: 18
Liked: 2 times
Joined: Aug 17, 2017 3:48 pm
Full Name: Paul Winkeler
Contact:

Re: Retrieve sessions for Backup Copy Jobs

Post by pwinkeler »

Great news: appending the source job name onto the copy job name did the trick and I can now list the sessions for the copy job!
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Retrieve sessions for Backup Copy Jobs

Post by oleg.feoktistov »

Glad we figured it out. Best regards!
pwinkeler
Influencer
Posts: 18
Liked: 2 times
Joined: Aug 17, 2017 3:48 pm
Full Name: Paul Winkeler
Contact:

Re: Retrieve sessions for Backup Copy Jobs

Post by pwinkeler »

As a follow up Oleg, what is the naming convention for replication sessions?
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Retrieve sessions for Backup Copy Jobs

Post by oleg.feoktistov »

Hi Paul,

For replica sessions JobName value corresponds to the name of an associated replica job. No tricks here. You will need to use ReplicaJobSession query, though. Example:

Code: Select all

/query?type=ReplicaJobSession&format=Entities&filter=JobName=="Replication Job 1"
If you are asking about replication session's name meaning the name of a single run, it's in the following format: JobName@datetime.
Example:

Code: Select all

/query?type=ReplicaJobSession&format=Entities&filter=Name=="Replication Job 1@2022-03-18 16:31:15"
Best regards,
Oleg
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest