Happy Business Starts Here

Highlighted
Zuora Support

Limit the number of records returned by Query call with REST API

By default Query returns 2,000 records. Using REST API, how do I define a smaller batch size (e.g, 50 records) per query and use QueryMore to get the rest?



If you found my answer helpful, please give me a kudo ↑
Help others find answers faster by accepting my post as a solution √

4 REPLIES 4
Zuora Support

Re: Limit the number of records returned by Query call with REST API

You can pass batchSize field in conf section in the request payload. Here is an example.

 

curl -X POST -H "apiAccessKeyId: my_username" -H "apiSecretAccessKey: my_password" -H "Content-Type: application/json"  -d '{ "queryString": "select Id from Account", "conf": { "batchSize": "50" } }' "https://rest.zuora.com/v1/action/query"


If you found my answer helpful, please give me a kudo ↑
Help others find answers faster by accepting my post as a solution √

New Student

Re: Limit the number of records returned by Query call with REST API

I'd suggest updating the documentation for Action (Query) with this information.  I have an API use case where this information would have been useful up front versus digging around in Community posts.

Tags (1)
Zuora Support Moderator

Re: Limit the number of records returned by Query call with REST API

Hi @jwilliams, the conf > batchSize field is not shown in the request sample in the docs, but it is documented under REQUEST BODY SCHEMA:

 

Screen Shot 2018-11-01 at 8.34.17 AM.png

 

Thanks for pointing this out!

New Student

Re: Limit the number of records returned by Query call with REST API

David -

 

Thanks for the pointer.  I did not see the twistie to expand that section.

 

Warm regards,

Jim Williams