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
Former Employee

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


Diane Miller

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
},