Rest Admin API - Products

I’m using get products count API to get total products ( /admin/api/2023-01/products/count.json ),

then use get all products ( admin/api/2023-01/products.json ) to loop and sync all products.

With limit 50 per page, I am getting next page products by using “link” parameter in header .
I realize that it will not include link in header at some random pages. It is not fixed for every attempt.
Would like to check on this? Anyone has experiences / solutions for this?

The pagination experience might be a little easier with GraphQL. You could use QueryRoot.products to get a list of the shop’s products, which can be paginated.