11

I can't seem to find this information anywhere, but it seems that Salesforce imposes a limit of 25 records to be returned from a list view results call to the REST API.

Does anyone know if this is at all configurable? If not, what alternatives are there to be able to retrieve more than 25 records from a list view?

7
  • 1
    Even I couldn't find anything on this . I haven't worked on this or tried anything . I have silly approach.. can u change the default number of record in the listview for user who making the REST API call.. change it 50 or 100 .. then try. Thanks Commented Aug 4, 2015 at 17:27
  • I suspect this is related to the default number of records in the list view as suggested by @amidstCloud. Its not a REST limitation.
    – crmprogdev
    Commented Aug 4, 2015 at 18:04
  • Is querying the data to match the filter criteria an option you would consider?
    – Rao
    Commented Aug 4, 2015 at 18:32
  • @amidstCloud No dice, it seems. I'm using a list view that has 200 records per page as the default setting, yet I'm still limited to 25.
    – emroc
    Commented Aug 4, 2015 at 18:39
  • @Rao It's an option, though I'd prefer to avoid it as I'd have to refactor my entire solution.
    – emroc
    Commented Aug 4, 2015 at 18:39

2 Answers 2

9

I believe the documentation is just not updated for the REST API. I took a cue from Daniel's answer and tried to see what would happen if we pass the properties in the parameters of the rest query.. VOILA!!It worked and surprisingly it returned huge volume (max I have tried is 5k) of records too.

https://cs80.salesforce.com/services/data/v34.0/sobjects/Opportunity/listviews/‌​listViewId/results?limit=5000

You could also use offset to paginate the results (get the next 2000 records with the below query)

https://cs80.salesforce.com/services/data/v34.0/sobjects/Opportunity/listviews/‌​listViewId/results?limit=2000&offset=2000

UPDATE: My bad I checked it wrong. It returns a maximum of 2000 records irrespective of the limit value in the parameter

4
  • 2
    Nice. I've pinged the documentation team to see if they can add the missing details. Commented Oct 29, 2015 at 18:35
  • Cool, it will be good have it there.
    – Sam
    Commented Oct 29, 2015 at 20:26
  • offset param doesn't work for over 2000 records.
    – dzh
    Commented Nov 26, 2018 at 22:57
  • this should be the accepted answer. Exactly was i was looking for given the 25 record limit.
    – JPG
    Commented Mar 26, 2020 at 1:06
3

First up, I acknowledge that your question is about using the REST API. However, I couldn't find the equivalent in the REST API to what the SOAP API can do.

If you look at the equivalent request in the SOAP Partner API, executeListView, you will see that it takes a ExecuteListViewRequest parameter.

This includes a couple of interesting properties:

Name    Type   Description
limit   int    The maximum number of records to return. Default: 25
offset  int    The number of records to skip. Default: 0

So, the limit defaults to 25 and the offset to 0. I ran some tests against the Partner API. If I set the limit to 50 I got 50 records back rather than the default 25. I assume I could use the offset to page through the total results.

I'm not sure how you can do this in the REST API List View Results.

2
  • 1
    https://cs80.salesforce.com/services/data/v34.0/sobjects/Opportunity/listviews/listViewId/results?limit=5000. I have a maximum data of around 5000 and this has fetehed all the data!! I am wondering if this is better than SOQL where the limit of 2000 is imposed
    – Sam
    Commented Oct 29, 2015 at 10:06
  • its better to use limit and offset when you have large dataset, in your case you used limit 5k as you know your data by max is 5k what if its 100k then you will need to paginate then, each has a useage. Commented Jan 23, 2016 at 14:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .