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
Sonal ShrivastavaSonal Shrivastava 

Task ListView REST API returns only 25 records

The REST API used for getting list view records is /services/data/v35.0/sobjects/Task/listviews/<listViewId>/results. This API always gives first 25 records for the given listview id and the limit cannot be increased.

For rest of the objects like Account, Contact etc, it can be done through custom webservice using following approach: Get the query from the following API: /services/data/v35.0/sobjects/Account/listviews/<listViewId>/describe and then use the same query to fetch data. 

But in case of Task object, describe call i.e. /services/data/v35.0/sobjects/Task/listviews/<listViewId>/describe is not allowed. It gives the following error:
sObject type 'Activity' is not supported in describeSoqlListViews 

Is there any way to get all the records of Task ListViews?
Andy BoettcherAndy Boettcher
Using the ListView, the limit is 25 records - if you are looking to get ALL records, you want to query the Task object directly.
Daniel BallingerDaniel Ballinger
Perhaps how what you are after, since you are using the REST API, but I found that the SOAP API is more flexible in this area. See REST API List View Results - 25 record limit? (http://salesforce.stackexchange.com/q/85967/102)

Basically, the SOAP request ExecuteListViewRequest (https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_calls_executelistviewrequest.htm#sforce_api_calls_executelistviewrequest) parameter includes limit and offset options. Note that the limit defaults to 25 in the docs. By varying the offset you can page through all the results.
Daniel BallingerDaniel Ballinger
From my previous answer, it turns out you can use the REST API to define the limit and the offset, it just isn't documentated currently.

Try:
/services/data/v35.0/sobjects/Task/listviews/<listViewId>/results?limit=2000

/services/data/v35.0/sobjects/Task/listviews/<listViewId>/results?limit=2000&offset=2000


 
Sonal ShrivastavaSonal Shrivastava
Thanks a ton Daniel. I am using the REST limit option now. I had started with the SOAP approach as well but that was taking time. Thanks for the input :)
Mohamed Ibrahim 10Mohamed Ibrahim 10
When use offset more than 2000 even if 2001 it turn out with error:
[
  {
    "message": "Maximum SOQL offset allowed is 2000",
    "errorCode": "NUMBER_OUTSIDE_VALID_RANGE"
  }
]
so currently i can't pull more than 4000 record !