REST API knowledge exchange
Post Reply
gmuthireddy
Lurker
Posts: 1
Liked: never
Joined: Feb 21, 2020 12:47 am
Full Name: Girish Kumar Muthireddy
Contact:

API to ADD or Delete VMs to a Veeam Backup Jobs

Post by gmuthireddy »

Is there any curl command to DELETE VMs from a Veeam Backup job or to ADD VMs to Veeam Backup jobs.? If so, please help me in finding it. Thanks.
benyoung
Veeam Software
Posts: 149
Liked: 47 times
Joined: May 25, 2016 3:29 am
Full Name: Ben Young
Contact:

Re: API to ADD or Delete VMs to a Veeam Backup Jobs

Post by benyoung »

There most certainly is. well, there is an API, you can use whatever means of triggering the API

You are after this resource
https://helpcenter.veeam.com/archive/ba ... ludes.html

You can post the new object, along with the desired settings to the /job/{id}/includes

You will also need to perform a lookup to fetch the HierarchyObjRef via the lookupsvc

https://helpcenter.veeam.com/archive/ba ... upsvc.html

Deletions are done using
https://helpcenter.veeam.com/docs/backu ... ml?ver=100

And before all that, if you are not aware you will need to login and use the returned session id (in the headers of the response) - and set the X-RestSvcSessionId on calls to any of the above. Here is how to auth

https://helpcenter.veeam.com/archive/ba ... ation.html


If you have access to powershell you can also perform these operations using this instead of via the enterprise manager API
dvepa
Lurker
Posts: 1
Liked: never
Joined: Aug 02, 2023 1:26 pm
Full Name: Durga Vepa
Contact:

Re: API to ADD or Delete VMs to a Veeam Backup Jobs

Post by dvepa »

Hi,
I tried to add VM to a job from Veeam UI (Backup and replication). When I make and API request to return all the jobs, it gave the jobs along with objects. I could find the VM (object) in the response which has "HierarchyObjRef": "urn:VMware:Vm:<hierarchyRootId>.<vmid>".
1. this hierarchyRootId is not found anywhere in the /api/hierarchyRoots API or query.
2. When I try to retrieve the UID of vCenter (from /api/hierarchyRoots response) to add object to job API as below:
API: /api/jobs/{ID}/includes
Request body: {
HierarchyObjRef: hierarchyObjRef, // UID
HierarchyObjName: hierarchyObjName,
}
It gives VMware host not found in the response !!
3. I tried to fetch the VM from lookup API call as:
API: /api/lookup?host=<UID>&name=${vmName}&type=Vm
It gives {
"HierarchyItems": []
}

What UID gets added to the VM from Veeam UI, what UID should we pass in the API request and how to find it ?
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 669 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: API to ADD or Delete VMs to a Veeam Backup Jobs

Post by oleg.feoktistov »

Hi,

Can't see anything wrong with your workflow. Looks like some technical issue that requires checking logs and DB.
Please reach out to our support engineers and let them have a look. Also, share the case id here for the reference.

Best regards,
Oleg
Post Reply

Who is online

Users browsing this forum: Ema.T and 7 guests