Skip to main content

Onboard HyperV and Backup using APIs

Here is a step-by-step guide to onboard a particular hypervisor and perform backup using Commvault REST APIs.

Pre requisites

Get the credential that can be used from Credential API

Get the accessNodes that can be used from AccessNodes API

Get the plans that can be used from Plans

Step 1: Install the hypervisor client

To create a hypervisor, we first need accessNodes , credentials and other inputs based on the type of the hypervisor.

API Endpoint: Create Hypervisor

Request:

POST /V4/Hypervisor

Request Body:

{
"name": "string",
"hypervisorType": "VMW",
"accessNodes": [
{
"id": 0,
"name": "string"
}
],
"credentials": {
"id": 0,
"name": "string"
},
"vcenterHostName": "string"
}

Response

{
"response": {
"hypervisorId": 0,
"errorCode": 0,
"errorMessage": ""
}
}

Step 2: Create a VM Group

Add a VM group to identify a specific set of virtual machines to back up or restore. The response of the API contains the ID of the VM Group

API: Create VM Group

Request:

POST /v4/vmgroup

Request Body:

{
"name": "VMGroupName",
"Hypervisor": {
"id": 10,
"name": "HypervisorName"
},
"content": {
"overwrite": false,
"virtualMachines": [
{
"name": "testVm",
"GUID": "string",
"type": "VM"
}
],
},
"plan": {
"id": 10,
"name": "planName"
},
"enableIntellisnap": false
}

Response

{
"subclientId": 10,
"errorCode": 0,
"errorMessage": ""
}

Step 3: Backup VM Group

Trigger VM Group Backup using APIs

API: Backup VM Group

Request:

POST /v4/vmgroup/4/backup?backupLevel=FULL

Response:

{
"taskId":2,
"jobIds": [
"24"
]
}