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
Peter Somogyvari 13Peter Somogyvari 13 

Pagination In Custom APEX REST Endpoint

Hiya,


In my custom APEX REST endpoint, I want to have the exact same pagination as the SFDC REST API.
Is there an easier way to achieve this than implementing the logic from scratch? I would love to just extend abstract base class that holds all this logic and is used by the SFDC REST API as well. Or something similarly convenient, that doesn't involve me re-inventing the wheel.


Thanks in advance,
Peter
ProlayProlay
If you are looking for SOQL next recordset you can check out this linkhttp://stackoverflow.com/questions/10419376/salesforce-rest-api-query-more-than-2000
Durai PandiDurai Pandi
We can very well do it in REST API to execute SOQL query.
How do we do the same implementation for APEX REST?
ProlayProlay
Dear ProServ,

Give me the details of your objects; I will provide you the code for APEX REST.
Durai PandiDurai Pandi
I want to create an ApexREST to get list of contact records by applying some logic. This may return more than 50K records.
I want to send the result in batch as we do it in REST API Query resource which used NextRecordsURL.
ProlayProlay
@Duari,

You are trying to develop the Controller class using ApexREST. Is that the purpose?
ProlayProlay
Because the sentence "I want to send them in batch...", I was thinking that you want to process the records in Batch Apex.

What I understood that you have the VF page and the controller is ApexREST. Correct me if I am wrong?
Durai PandiDurai Pandi
Yes, looking for apexREST.
I think we need to use limit and offset values as parameters and returns the query to calling part.
got another response --> https://developer.salesforce.com/forums/ForumsMain?id=9060G000000I1oLQAS

appreciate if you could provide any other best solution.
 
Durai PandiDurai Pandi
I got your second response bit late.
I don't have VFP, instead sending the response to JAVA.