Get All Products

How to get all products using GraphQL query?

That one you have to learn your pageation. you can only retrieve 100 products at a time, so after you get the first 100, you need to get the next 100. Here is a python script that gets all the locations using the same method. you will need to modify this script to grab products and the product info your looking for. I put some time things to slow it down, it may need some adjustment there, as when it runs, it will make you run out of credits fast.


I tried this method it worked but only 1600 products synced after that recursion killed. can you please suggest any solution, I am working in laravel.

@JustinAnchored do you think it needs to refresh slower for the credits? @abubakar What exactly happens after 1600? Could it be a case where you need to adjust the information your receiving? Do you have a request id?

Thank You for reply, actually I am using recursive method to fetch all the products using hasNextPage value, but after 1600 products fetched jobs becomes failed, although hasNextPage is still true but recursion is killed

Could it have been hitting a quota? Here is some more information on how to optimize your query Getting Started – Developer Resources | ShipHero

I think Theresa is on the right track.
If it goes too fast, it may run out of credits, and with the time delay it helps, but the time delay may not be enough. In my example I have a start Courser, so maybe when it does error out, if you happen to have that courser number it stopped at, you can always restart it where you left off.

1 Like

Just chiming in to say that you’re probably getting the error that says that you’re out of credits. Depending on the time of day and what data you’re getting, anywhere between 1000 records and 1700 records is usually where I see it happen, too.

Your credits refill fairly quickly, and I found that 4 to 7 seconds between calls seems to work well. You can actually use the error that comes back and it will tell you how many seconds until you have enough credits to run the query again. That’s what I do with my scripts. I watch for that error and I parse the number of seconds out of that field and just have my script “sleep” for that amount of time and try again.

1 Like