Questions and discussions about using the Shopify CLI and Shopify-built libraries.
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:
- https://888f7c2e6c60.ngrok.io/rest/v1/?path=products/count&shop=lachlantest2.myshopify.com
- returns /admin/api/2022-01/products.json
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=eyJsYXN0X2lkIjo3NjMzMTY3MDU3MTI1LCJsY...
- 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?
Solved! Go to the solution
This is an accepted solution.
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)?
To learn more visit the Shopify Help Center or the Community Blog.
This is an accepted solution.
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)?
To learn more visit the Shopify Help Center or the Community Blog.
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?
To learn more visit the Shopify Help Center or the Community Blog.
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!