Skip to main content

Hello,

When I try: Command : http://<<webserver>>:81/SearchSvc/CVWebService.svc/VM I got only the first 100 VMs entry in alphabetical order back.

there is no error!

Have any one an idea why not all, we have around 2000 VMs.

thanks in advance

Juergen

Hey Juergen,

Would you be kind enough to provide the response output header + content?

Also can you confirm your service pack / feature release version?

Thanks
Edd


Hi Juergen

This may be down to paging size. The default page size is 100 results and pages are indexed.

You can modify the page size and page index returned using pagingInfo request header.

By default the first 100 records are returned, page index 0. which would be provided in the request header as “pagingInfo: 0,100”

If you want to return the next 100 records, this is index 1, so “pagingInfo: 1,100”.

You can modify the page size to return a larger set, for example the first 500 records would be requested in the header as “pagingInfo: 0,500”, the next 500 would be “pagingInfo: 1,500”, etc.

As Edd suggests, please provide the service pack version, request header and the programming interface used to make the requests and we may be able to assist further with your API calls.

Thanks,

Stuart


Hi Juergen

This may be down to paging size. The default page size is 100 results and pages are indexed.

You can modify the page size and page index returned using pagingInfo request header.

By default the first 100 records are returned, page index 0. which would be provided in the request header as “pagingInfo: 0,100”

If you want to return the next 100 records, this is index 1, so “pagingInfo: 1,100”.

You can modify the page size to return a larger set, for example the first 500 records would be requested in the header as “pagingInfo: 0,500”, the next 500 would be “pagingInfo: 1,500”, etc.

As Edd suggests, please provide the service pack version, request header and the programming interface used to make the requests and we may be able to assist further with your API calls.

Thanks,

Stuart

My gosh this was a timely post. I may be showing my REST newbiness but I had never come across the pagingInfo header before and it was driving me a silly for an hour how I could find a smart way around it.


Hi Stuart,

great answer this solved my issue.

My env: CV V11SP20.32, programing interface is Python3.8, my header contains only the token.

I am a newbee in using REST API, now I will check what else is missing in my header.

One more question is ther a limit for “Page size” ?

Thanks

Juergen


Hi Juergen

I’m not sure there is a limit for pagesize, I’ll have to look into it for you, but it’s a balancing act.

A large pagesize places more load on the server returning a large dataset and will consequently take longer to return.

So, a smaller, indexed page size reduces load and offers better performance. But for specific queries, run less often where you are prepared to wait, you could set something like “0,2000” and see if the full list of VMs is returned.

Some food for thought and to offer up a challenge: could python code be written to obtain total number of VMs, then build subsequent queries to pull multiple, sequential pages to build the full list of VMs?

For reference, here’s the link to the REST API page for GET Virtual Machines:
https://documentation.commvault.com/commvault/v11_sp20/article?p=125353_1.htm

Thanks,

Stuart


@Juergen   What is the ultimate goal?   I know this originated as REST API question, but it sounds like you are building some automation/extraction.    With commvault we can build reports and export them as a rest API endpoint, so you can do all your data manipulation in CV within a UI, and hit a single endpoint to get the data to do whatever else you are looking to do.  


Hi Juergen

Just to round off this topic, I have been in touch with our Development team who said the absolute maximum value for pagesize is set very high, so in practical terms may be considered unlimited.

Setting a pagesize of 2000 is entirely reasonable, with performance governed more by environmental factors, web server resources, network, SQL, etc.

Thanks,

Stuart


Reply