Paginate the 2019-07 REST Product API

Solved
Excursionist
13 1 0

I switched to the 19/07 version of the product API and noticed that passing the page parameter with the endpoint will generate an error:

{"errors":{"page":"page cannot be passed."}}

 

Is the pagination functionality changed in this new version?

Using the 2019-04 works sweetly.

 

Thank you

0 Likes

Success.

Community Manager
Community Manager
488 21 51

Hi @Giulio1,

 

We replaced page-based pagination for a number of endpoints in the 2019-07 version. This was done in favour of a much more performant method of pagination we've also released for these endpoints called cursor-based pagintion. We've released this guide on how to make calls using cursor-based pagination. The TLDR is that you need to look for the "Link" response header in your requests. The value of this header will be a link to both the next and previous page of results in the following format.

 

#...
Link: "<https://{shop}.myshopify.com/admin/api/{version}/products.json?page_info={page_info}&limit={limit}>; rel={next}, 
<https://{shop}.myshopify.com/admin/api/{version}/products.json?page_info={page_info}&limit={limit}>; rel={previous}" #...

That being said, you can continue making requests with the page param using the 2019-04 version until it is no longer supported with the release of 2020-04.

 

Let me know if you have any lingering questions or concerns.

 

Cheers,

1 Like
Excursionist
13 1 0

Thank you @Busfox 

 

That is pretty clear 

0 Likes