Mapping TaskId to SessionId

RESTful knowledge exchange

Mapping TaskId to SessionId

Veeam Logoby mwpreston » Thu Jul 27, 2017 1:47 pm

Hey All...

When starting a backup job via the REST API I am returned a taskId - this task stays running for a moment and then reports success with a message of "Triggered backup job" or something along those lines. What I'm looking to do is actually monitor the status of the job I just kicked off - which I believe is done through the backupSessions resource.

So - long story short - am I able to take that taskId and somehow retrieve the sessionId which it kicked off?
Or am I best to simply comb through backupSessions and take the latest one associated with my job name?

I'd rather perform the first option as it seems like it would be a little more accurate - just not sure if its possible?

Thx
mwpreston
Veeam Vanguard
 
Posts: 73
Liked: 9 times
Joined: Tue May 25, 2010 3:27 pm
Full Name: mike

Re: Mapping TaskId to SessionId

Veeam Logoby Manfriday » Thu Sep 28, 2017 7:34 pm

Im running into the same issue. Did you ever find a solution?
Manfriday
Influencer
 
Posts: 12
Liked: never
Joined: Tue Sep 15, 2009 6:03 pm
Full Name: Jason Morris

Re: Mapping TaskId to SessionId

Veeam Logoby Manfriday » Thu Sep 28, 2017 10:16 pm

Ok, well. I found a solution.

I have only been working with rest for a day and a half now, so I'm not sure it is the BEST solution, but I got it to work.

Basically, I did a POST to backupServers , running a VeeamZip task.
I got a TaskID from the response, which I used to do a GET on /api/tasks
I waited for the show a State of "Finished" and found the UID for the backup session, in an Href.
I pulled out the junk so I was left with a session ID in this format:

a172e3af-e560-4dab-abd9-42c5024053c5?format=Entity

Then I was able to do a GET on backupSessions to find the status of the backup task.

As I said, I have only been fiddling with REST for a day and a half, so that may not be the best way to do it.
If there is an easier way to do it, feel free to chime in. :)
Manfriday
Influencer
 
Posts: 12
Liked: never
Joined: Tue Sep 15, 2009 6:03 pm
Full Name: Jason Morris


Return to RESTful API



Who is online

Users browsing this forum: No registered users and 1 guest