Forum Discussion

VijayKasindala's avatar
VijayKasindala
New Contributor
12 months ago

HTTP request GET pagination issue with trustpilot API

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

 

Thanks,

Vijay

4 Replies

  • svatada's avatar
    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 

     

  • ivicakoteski's avatar
    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.

     

     


    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.

  • 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