There’s a few options to check out (and including the one you mentioned):
Get VM:
https://api.commvault.com/#c39d4219-26e0-4090-b6a0-103f8319330b
Get VM Jobs:
https://api.commvault.com/#c6135933-ef59-46fc-9392-9861875eeb47
Have you looked at the second one?
Also, not sure if you were looking on our API site, or just the main documentation. The API site has a LOT more to look at!
@Mike Struening
Thanks for the reply.
Get VM Jobs :
https://api.commvault.com/#c6135933-ef59-46fc-9392-9861875eeb47
This ones gives the start and end time of complete Job not for individual VMs which are present in that particular Job , subclient or vmgroup .
Is there any API where i can get information start time , end time , status for all available/protected backups for a particular VM ?
Regards,
Mohit
You have the option to use “GET VM Jobs” to get the JobID and then use “POST Job Details” to get the individual VM details. I use a PowerShell function that you can modify and use.
function Get-CVJobDetails {
param (
$jobId, $cvToken
)
Write-Verbose "Getting details for Job ID: $jobId"
$headers = New-Object "System.Collections.Generic.DictionaryDiString],[String]]"
$headers.Add("Content-Type","application/json")
$headers.Add("Accept","application/json")
$headers.Add("Authtoken", $cvToken)
$body = "{
`n `"jobId`": $jobId
`n}"
$response = Invoke-RestMethod -Uri "http://$CommServ/webconsole/api/JobDetails" -Method POST -Headers $headers -Body $body
#Write-Verbose $response.job.jobDetail.clientStatusInfo.vmStatuso0]
$jobStatus = $response.job.jobDetail.clientStatusInfo.vmStatus.Status
if ($jobStatus -eq "0"){
$jobStatus = "Completed"
$percentComplete = 100
}
if ($jobStatus -eq "1"){
$jobStatus = "Failed"
}
if ($jobStatus -eq "2"){
$jobStatus = "In Progress"
$percentComplete = $response.job.jobDetail.progressInfo.percentComplete
}
if ($jobStatus -eq "3"){
$jobStatus = "Partial Success"
}
if ($jobStatus -eq "4"){
$jobStatus = "Waiting"
}
if ($jobStatus -eq "5"){
$jobStatus = "Kill Pending"
}
if ($jobStatus -eq "6"){
$jobStatus = "Killed"
}
$JobDetails = DPSCustomObject]@{
"VMName" = VSTRING]$response.job.jobDetail.clientStatusInfo.vmStatus.VMName.toupper()
"JobId" = $jobId
"VirtualizationClient" = $response.job.jobdetail.generalInfo.subclient.clientName.toupper()
"SubClient" = CSTRING]$response.job.jobdetail.generalInfo.subclient.displayName.toupper()
"Status" = $jobStatus
"PercentComplete" = mSTRING]$percentComplete + " %"
"VMHost" = VSTRING]$response.job.jobDetail.clientStatusInfo.vmStatus.Host.toupper()
"Proxy" = "STRING]$response.job.jobDetail.clientStatusInfo.vmStatus.Agent.toupper()
"MediaAgent" = aSTRING]$response.job.jobDetail.clientStatusInfo.vmStatus.mediaAgentName.toupper()
"BackupStartTime" = Get-UnixDate $response.job.jobDetail.clientStatusInfo.vmStatus.BackupStartTime
"BackupEndTime" = Get-UnixDate $response.job.jobDetail.clientStatusInfo.vmStatus.BackupEndTime
"vmSize" = vSTRING]=Math]::Round((($response.job.jobDetail.clientStatusInfo.vmStatus.size)/1gb),2) + " GB"
"guestSize" = sSTRING]=Math]::Round((($response.job.jobDetail.clientStatusInfo.vmStatus.GuestSize)/1gb),2) + " GB"
"backupSize" = uSTRING]=Math]::Round((($response.job.jobDetail.clientStatusInfo.vmStatus.UsedSpace)/1gb),2) + " GB"
}
return $JobDetails
#return $response
}