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

How to retrieve more than 2000 records returned from the rest api in Salesforce ?

Hi Expert,

how to retrieve more than 2000 records returned from the rest api in Salesforce.
When I execute the below query through rest api then it will return only 2000 records.
https://" + instanceName + "'SELECT+Id,Name,ParentId,Phone,Website,Description,OwnerId+FROM+Account'

I'm stuck on this salesforce limit.
Help on this how to get more than 2000 records through rest api.

Thanks & Regards
Mukesh Kumar
Hi Rahul,

Thanks for reply.I have visited all these link but this is not worked in my code.
Actualy I'm call Rest Api through Jquery and in the jquery return only 2000 Records.

snipet of code
ChromeForce.prototype.callRestApi = function(path, method){
        var deferred = $q.defer();
            method: method,
            url: this.getServiceEndpoint(path),
            headers: {
                "Authorization": "Bearer " + sessionId
        }).then(function successCallback(response) {
            return deferred.resolve(response);
        }, function errorCallback(response) {
            return deferred.reject(response);
        return deferred.promise;

api.callRestApi('/query?q=' + soqlquery_kld, 'GET')
                        $scope.myOrganization =;
                        Soql_filter_Records =;
                        $scope.isSpinShow = false;
                        $scope.NoofRecords123 = false;
                        $scope.OnlyOneRecord = false;
                        if (response.statusText == 'OK') {
                            $scope.isResponseOk = true;
                        $scope.TotalNumberOfRecords =;

                    }, function(err){
                        $scope.myOrganization = $scope.err;
                        $scope.isLoading = false;
                        $scope.errorMessage = $scope.err;
                        $scope.isSpinShow = false;
                        $scope.IsError = true;

Mukesh Kumar