How to make paginated requests to the REST Admin API using App Bridge Authenticated Fetch?

How do I make paginated requests using App Bridge authenticated fetch to the REST Admin API? I’m not seeing it anywhere in the documentation and the app-bridge github repo is 404.

Initial authenticated fetch request:

I attempt to add a query param using the page_info from the initial response:
- https://888f7c2e6c60.ngrok.io/rest/v1/?path=products&page_info=eyJsYXN0X2lkIjo3NjMzMTY3MDU3MTI1LCJsYXN0X3ZhbHVlIjoiYmxhaDE1IiwiZGlyZWN0aW9uIjoibmV4dCJ9&shop=lachlantest2.myshopify.com

  • returns the same response as the initial /admin/api/2022-01/products.json

More generally, how to you pass query params (e.g., limit=250) to authenticated fetch URI?
Is the pagination failing because of https://shopify.dev/api/usage/pagination-rest#parameters?

When your server receives the (second) request, does it receive the page_info parameter?

If you’re not sure, can you please paste your server code (that handles requests to /rest/v1)?

Hi, yes it does. but it is the same page_info value as the initial request, as is the body.

page_info=eyJsYXN0X2lkIjo3NjMzMTY3MDU3MTI1LCJsYXN0X3ZhbHVlIjoiYmxhaDE1IiwiZGlyZWN0aW9uIjoibmV4dCJ9

that is the value that is being passed in as the query a param. I’ve attached a photo as well.

Let try to isolate the problem …

If you don’t use App Bridge and authenticated-fetch, are you able to make paginated requests from your server successfully?

Your suggestion helped uncover the issue. The server was extracting the params correctly from the authenticated fetch URI, but was not setting those entries correctly in the Admin API’s request.query object.

Thanks very much for your help!

1 Like