You need to sign in to do that
Don't have an account?
Durai Pandi
ApexREST and NextRecordsURL
We can fetch 200 to 2000 records in REST API using NextRecordsURL and 'Sforce-Query-Options: batchSize' request header field.
I want to implement similar functionality in my ApexREST so that the resource returns more than 50K records and send batch by batch based on the header parameter value passed as in REST API.
Highly appreciate anyone shed light on this issue.
I want to implement similar functionality in my ApexREST so that the resource returns more than 50K records and send batch by batch based on the header parameter value passed as in REST API.
Highly appreciate anyone shed light on this issue.
You can name it as NextRecordsURL.
Prepare a URL and pass required parameters (like start index, records size, etc.) in that URL which you need to send next set of records
This URL will then be used by other system to invoke next request.
When all records are send, pass null in NextRecordsURL.
When the other system receives null then they should stop invoking the request.
Hope it helps!!
Thanks
Varsha
Thanks for your response.
If we are manually building the URL, do we need to call the service again?
Can you please clarify?
I am curious about how the Query API works.
If the query returned more than 2K records, along with the response it sends the NextRecordsURL.
/services/data/v37.0/query/01gp000000AJ51VAAT-800
In the above nextRecordsUrl, does the ID reflect the API or something else?
That solution will work for custom Apex Rest API.
What you are looking for? Standard API URL or creating Custom RestResource API apex class?
But just wanted to understand how the standard one works.
Let me try the one you suggest.
Could you please share your code here?
-
Thanks,
Zakeer.