Tell me more ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

is it possible to set the batch size for queries via REST API? The REST API Query documentation http://www.salesforce.com/us/developer/docs/api_rest/Content/resources_query.htm states For more information on query batch sizes, see Changing the Batch Size in Queries in the SOAP API Developer's Guide. . I know that I can set the QueryOptions via SOAP header, but is it possible to set it for REST somehow?

C# Sample for the SOAP API

private void queryOptionsSample() 
{
    binding.QueryOptionsValue = new QueryOptions();

    binding.QueryOptionsValue.batchSize = 250;
    binding.QueryOptionsValue.batchSizeSpecified = true;
}

Any help and example would be much appreciated!

Thanks

share|improve this question

1 Answer

http://www.salesforce.com/us/developer/docs/api_rest/Content/dome_query.htm

Reading this document we can do a batch query in REST API too

If the initial query returns only part of the results, the end of the response will contain a field called nextRecordsUrl.

For example, you might find this attribute at the end of your query: "nextRecordsUrl" : "/services/data/v20.0/query/01gD0000002HU6KIAW-2000"

In such cases, request the next batch of records and repeat until all records have been retrieved. These requests use nextRecordsUrl, and do not include any parameters.

Update:

Other way would be to build apex REST SERVICE yourself using OFFSET in query .

share|improve this answer
 
yes, but whats not the question. I am after changing the batch size of the query, so instead of receiving 2000 records per page, I just want to receive 150, without using offset –  Seb__Wagner Aug 14 at 8:37
 
I think its by default 500 or so .It chunks depending on the size .Other way would be to build apex REST SERVICE yourself using OFFSET . –  Mohith Kumar Aug 14 at 8:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.