Get transactions in batches

Zeeshan_Mahmood
Shopify Partner
6 0 3

Is it possible to retrieve Transactions in batches? I currently retrieve orders using:

ShopifyAPI::Order.find(:all, params: {ids: order_ids.join(',')})

Where order_ids contains up to 50 order_ids. However, if I try to get the transactions attached to the other, it makes one get request per transaction, looking into the ShopifyAPI code under the hood it's doing this:

Transaction.find(:all, :params => { :order_id => id })

I tried loading it in batches using:

Transaction.find(:all, :params => { :order_ids => order_ids.join(',') })

However, I get an error from the API saying that order_id is not defined. Order_id only gets the transactions for one order, any way to look this up in batches?

For context, I'm trying to write some reporting/analytics on our own side around the transactions, so looking up the transaction on an per-order basis leads to making too many requests and getting an error code 429. I can create a rake task that does this slowly and schedule it through cron, but I thought I'd ask if it's possible to grab them in batches since having a job is less than ideal.

ClementG
Shopify Partner
660 0 127

I am facing the exact same problem.

Did you ever find a better solution?

At a rate of 2 per second, it can take several hours or even days to load all transactions!

0 Likes
Boyadzhiev
Tourist
3 0 0
0 Likes