function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Raghu007Raghu007 

Fetching more than 2000 records via REST API

Hi All,

I am trying to fetch records from another salesforce ORG using REST API. I found that we can fetch upto 2000 records only. Now digging more into this, I found that we need to use NEWRecordURL for fetching remaining records.

With that I am facing some challenges fetching more than 2000 records via REST API. Does anyone have some sample code/snippet with which I can achieve that using NewRecordURL?

Thanks in advance.

Sumit Kumar Singh 9Sumit Kumar Singh 9
I think yo can use querymore. 
https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_query.htm
https://developer.salesforce.com/forums/?id=906F000000093JVIAY
Rakesh Thota 15Rakesh Thota 15
Hi Raghu007,

Please refer this links it may help you finding the solution.
  1. http://stackoverflow.com/questions/24321382/salesforce-query-returns-only-2000-data
  2. https://salesforce.stackexchange.com/questions/169188/fetch-more-than-2000-records/169214
Please make sure that you mark it as solved if it helps you.

Best Regards,
Rakesh Thota.