REST API knowledge exchange
Post Reply
mwpreston
Enthusiast
Posts: 73
Liked: 9 times
Joined: May 25, 2010 3:27 pm
Full Name: mike
Contact:

Mapping TaskId to SessionId

Post by mwpreston »

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
Manfriday
Influencer
Posts: 16
Liked: 1 time
Joined: Sep 15, 2009 6:03 pm
Full Name: Jason Morris
Contact:

Re: Mapping TaskId to SessionId

Post by Manfriday »

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

Re: Mapping TaskId to SessionId

Post by Manfriday »

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. :)
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest