cancel
Showing results for 
Search instead for 
Did you mean: 

HTTP request GET pagination issue with trustpilot API

VijayKasindala
New Contributor

Hello,

I am calling Trustpilot API using HTTP request snap.

I have given below values in 'Next URL' and 'has next' values in HTTP request snap.

It is only giving 20 records.can you please provide your inputs?

jsonPath($, "$.[*].links[?(@.rel=='next-page')].href")[0] 

jsonPath($, "$.[*].links[?(@.rel=='next-page')].href")[0].lenghth>0

VijayKasindala_0-1721276734894.png

 

Thanks,

Vijay

4 REPLIES 4

svatada
Former Employee

Try below exp:

nextPageUrl

jsonPath($, "$.links[?(@.rel=='next-page')].href").length > 0 ? jsonPath($, "$.links[?(@.rel=='next-page')].href")[0] : null

hasNextPage

jsonPath($, "$.links[?(@.rel=='next-page')].href").length > 0 

 

VijayKasindala
New Contributor

Thank you for reply.

It did not work.I am getting only first page results.

VijayKasindala_0-1721299961952.png

 

ivicakoteski
New Contributor III

Hi @VijayKasindala,

There are two potential issues:
1. You are attempting to access the output data of the JSON Parser from the initial snap HTTP Client - Get, so this approach will not work. You can only access the output data of the HTTP Client - Get.

ivicakoteski_3-1721375363722.png

 

ivicakoteski_2-1721375252082.png

 


2. According to the HTTP Client Snap documentation, the 433patches21307 update has introduced an issue that changes behavior: "pagination evaluation now occurs before sending the output to the output view".
A workaround for pagination using the HTTP Client Snap has been proposed, and you can find the details at the following link: https://docs-snaplogic.atlassian.net/wiki/spaces/SD/pages/3097822264/Pagination

Hope this helps!

Kind regards,
Ivica.

VijayKasindala
New Contributor

Thank you for update.I have changed to 'REST get' snap.It is working fine.

Next URL :jsonPath($, "$entity.links[?(@.rel=='next-page')].href")[0]

HasNext : jsonPath($, "$entity.links[?(@.rel=='next-page')].href").length > 0