How to query SFDC with nextRedordsUrl with in the same api call ?

HI,

When i hit SFDC standard REST api's and if it responds saying -

{ "totalSize": 2367, "done": false, "nextRecordsUrl": "/services/data/v39.0/query/01gn002345GHTRD0987AR-2000", "records": [ ] }

How can i hit with nextrecordsURL and send consolidated results to client?

Please lt me know if you have solution for this, thanks.

Regards,

Hareesh N.

Solved Solved
0 2 873
1 ACCEPTED SOLUTION

HI @HAREESH

Welcome to the Community !!

Since this is used for pagination, I would not recommend you to build logic to fetch all the records in Apigee (however Apigee can do it with custom JS policy). You should use Apigee as a pass through proxy so that the calling app gets to know that there are more than 2000 records and get the next set, they just need to hit the nextRecordsUrl which is proxied via Apigee

However, you can always have Apigee orchestrate that but not a good option. Say the above query had 10000 records and pageSize is 2000, then you will keep seeing different nextRecordsUrl for next pages. Not right for Apigee to make all those calls for all those pages and then send the records to the calling application. There might be delay in responding with all records

Since the backend already supports Pagination, you should extend that to the calling app as well. If the calling app wants different rowsPerPage, it can pass the necessary query params and the backend can honor that and send the results accordingly.

Hope this helps !

View solution in original post

2 REPLIES 2

HI @HAREESH

Welcome to the Community !!

Since this is used for pagination, I would not recommend you to build logic to fetch all the records in Apigee (however Apigee can do it with custom JS policy). You should use Apigee as a pass through proxy so that the calling app gets to know that there are more than 2000 records and get the next set, they just need to hit the nextRecordsUrl which is proxied via Apigee

However, you can always have Apigee orchestrate that but not a good option. Say the above query had 10000 records and pageSize is 2000, then you will keep seeing different nextRecordsUrl for next pages. Not right for Apigee to make all those calls for all those pages and then send the records to the calling application. There might be delay in responding with all records

Since the backend already supports Pagination, you should extend that to the calling app as well. If the calling app wants different rowsPerPage, it can pass the necessary query params and the backend can honor that and send the results accordingly.

Hope this helps !

Thanks for your suggestion Sai. I will update you back how it goes.