cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Pagination in REST API

Siva_Venna
Contributor

A very good explanation of how to implement pagination in REST API in this below blog post:

When I try to implement the same(I am extracting data from survey monkey api), I have noticed that when the โ€œNext URLโ€ is executing it is ignoring the query parameters provided.As shown in below image, when service URL is executing itโ€™s getting right records considering all input query parameters i.e total:3043 but when โ€œNext URLโ€ is hitting it is extracting all records i.e. total : 61896
capture2

How to include query parameters in โ€œNext URLโ€ to get required data?

9 REPLIES 9

Thank you ptaylor, for timely responses.
I tried with specified Has next and Next URlL parameters but no luck
snapset

response_

As I have stated earlier in the second iteration itโ€™s fetching all the total records ignoring query parameters.

Unfortunately, the Survey Monkey API is omitting all of the other query parameters that are not paging-related from the URLs under โ€˜linksโ€™. So youโ€™ll have to add them to the Next URL:

$entity.links.next + โ€œ&start_created_at=โ€ + Date.now().minusDays(10) + โ€œ&end_created_at=โ€ + Date.now().minusDays(1) + โ€œ&sort_by=date_modified&sort_order=DESCโ€

I have tried this option earlier to posting in the community, it works when you specify Next URL with little modification as :
$entity.links.next + โ€œ&start_created_at=โ€ + Date.now().minusDays(10) + โ€œ&end_created_at=โ€ + Date.now().minusDays(1)

I suggest you to include this exception in the documentation for REST Snap i.e. Survey Monkey API will not accept โ€œoffsetโ€ value and it will omit query parameters.

Thank you ptaylor :+1:

dmiller
Admin Admin
Admin

@Siva_Venna, a ticket has been created for the Doc team.


Diane Miller
Community Manager

rahulkalyanwat
New Contributor

@ptaylor 

I am facing a Pagination issue while using re

rahulkalyanwat_1-1693809594874.png

 

st get the snap can you please help me with has next and next url.

rahulkalyanwat_0-1693809441939.png

rahulkalyanwat_2-1693809634108.png

https://api.XXXXXXXX.com/submgmt/api/v1/subscriptions/7057/users?limit=100&skip=

 

 

sample page info : 

},
"entity": {
"pageInfo": {
"totalCount": 109,
"startCount": 1,
"limit": 100
},