Pagination with REST API

Pagination with REST API

Mike-B
Visitor
3 0 0

I am trying to use the Shopify Products API to retrieve all of the products. However, because there are limits to the amount of records returned in a request (250 is the max), I have to use the 'nextPageURL' field to get the records from the next page. I am getting an error when doing this.

 

Note: I am using the Node Shopify API Client for these requests, and there are not authentication issues, as I am able to get the first page results just fine.

 

Here is how I try to get the next page results:

 

 

  const test = await shopifyAPIClient.get({
    path: "products",
    query: {page_info: nextPageUrl}
  });

 

 

nextPageURL has the nextPageURL returned from my first request.

 

When I do this, I get the following error:Screen Shot 2021-12-19 at 5.34.53 PM.png

 

When I use the actual URL that this request is using in my web browser, it retrieves the results correctly.

 

Am I doing something wrong with the Node API Client?

Replies 2 (2)

PTP
Shopify Partner
14 0 2

Did you ever figure this out? I'm trying to get pagination to work as well. Not much from the docs...

Mike-B
Visitor
3 0 0
I didn't end up needing pagination, so I did not figure it out