Skip to main content
Solved

REST API limitations?


Forum|alt.badge.img+1

Hi all,

We have 2 environments using Commvault (Dev - 195 VMs and Prod - 2175 VMs). In testing the REST APIs, I've found that the GET VM API only returns some VMs in the Prod environment. Is there a limitation to the number of records returned?

sample Powershell code:

$ccVms = Invoke-RestMethod "$cs/webconsole/api/VM" -Method 'GET' -Headers $headers

$vmGuid = $ccVMs.vmStatusInfoList | Where-Object name -eq $vmname | Select-Object -ExpandProperty strGUID

$vmEsxHost = $ccVMs.vmStatusInfoList | Where-Object name -eq $vmname | Select-Object -ExpandProperty vmHost


I've tried adding "Pageinfo: 0,3000" in the headers, but my code was not able to some VMs.

I've also tried GET /v4/virtualmachines but I’ve found that the API only returns ~103 VMs from Get Virtual Machines | Commvault®

 

Both environments are on 11.36.39

 

Best answer by Pradeep

Hi ​@clay,


Kindly use the parameters "start" and "limit" to get the paginated list of all VMs.
The total number of VMs should be returned by the field virtual Machines Count. To get all VMs at once, you can set the limit to virtual Machines Count or to a higher number.

For example : /v4/VirtualMachines?start=0&limit=2000

Below is reference API:
/v4/VirtualMachines?forUser=true&additionalProperties=true&start=0&limit=1000&sort=vmStatusInfoList.client.displayName%3A1&fl=vmStatusInfoList

View original
Did this answer your question?

3 replies

Forum|alt.badge.img+11
  • Vaulter
  • 246 replies
  • Answer
  • April 11, 2025

Hi ​@clay,


Kindly use the parameters "start" and "limit" to get the paginated list of all VMs.
The total number of VMs should be returned by the field virtual Machines Count. To get all VMs at once, you can set the limit to virtual Machines Count or to a higher number.

For example : /v4/VirtualMachines?start=0&limit=2000

Below is reference API:
/v4/VirtualMachines?forUser=true&additionalProperties=true&start=0&limit=1000&sort=vmStatusInfoList.client.displayName%3A1&fl=vmStatusInfoList


Forum|alt.badge.img+1
  • Author
  • Byte
  • 2 replies
  • April 11, 2025

Hi Pradeep,

Thanks! The start and limit parameters helped me to get all the VMs. Please excuse the newbie question, but is there somewhere I can get a list of all possible parameters or is this not Commvault related and more a REST API topic? 

Thanks,

Clayton


Forum|alt.badge.img+11
  • Vaulter
  • 246 replies
  • April 12, 2025

Hi ​@clay ,

Glad to know that its resolved. Going further request to refer below link for the latest parameter details.

https://api.commvault.com/docs/SP38/api/cv/OpenAPI3/vm-restore/


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings