A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
I am building a Node REST API that makes calls to a list of Products. I am using the 'since_id' parameter to only retrieve new records that have been added since the last call. However, I am noticing that duplicate records are being returned in my list. Has anyone else encountered this issue and found a solution to prevent the duplicate records? Any help would be greatly appreciated, thank you.
do { page = await shopify.api.rest.Product.all({ session: session, limit: 50, since_id: page.length > 0 ? page[page.length - 1].id : undefined, }); products = products.concat(page); } while (page.length > 0);
Hi @DelfineUmaku , This blog article here might be of some help to you https://www.shopify.com/partners/blog/relative-pagination. Perhaps including since_id=0 in the endpoint would help with this https://www.shopify.com/partners/blog/relative-pagination#:~:text=To%20ensure%20the%20first%20page%2...
Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
EDIT: "since_id=0" on the first page request solves the problem.
I'm experiencing the same. Basically what happen is, after certain page, the since_id becomes the same over and over, because page[page.length - 1].id returns the same ID, then we get the same results again.